flavor-code 1.2.6 → 1.2.7

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.
@@ -15,7 +15,7 @@ import {
15
15
  packageVersion,
16
16
  redactErrorText,
17
17
  transcriptReducer
18
- } from "./chunk-RYDCJHXW.js";
18
+ } from "./chunk-5RHJ3PQN.js";
19
19
  import "./chunk-HFR2WS6T.js";
20
20
  import {
21
21
  Box_default,
@@ -13918,9 +13918,17 @@ async function createProductionRuntime(options) {
13918
13918
  const home = resolve21(options.home ?? homedir());
13919
13919
  const environment = options.environment ?? process.env;
13920
13920
  const ide = new FlavorIdeClient({ workspace, home, environment });
13921
+ const ideReady = ide.initialize();
13922
+ const gitRepository = detectGitRepository(workspace);
13921
13923
  const loaded = await loadConfig({ cwd: workspace, home, environment });
13922
- await ide.initialize();
13923
13924
  const config = loaded.config;
13925
+ const mcpReady = connectMcpServers({
13926
+ servers: config.mcpServers,
13927
+ workspace,
13928
+ clientFactory: options.mcpClientFactory ?? connectSdkMcpClient
13929
+ });
13930
+ mcpReady.catch(() => void 0);
13931
+ let mcpDiscarded = false;
13924
13932
  const sessionStore = new SessionStore({ workspace, maxSessions: config.maxSessions });
13925
13933
  const memoryStore = config.memory.enabled ? new MemoryStore({
13926
13934
  workspace,
@@ -14148,12 +14156,6 @@ async function createProductionRuntime(options) {
14148
14156
  await pluginHost.loadAll();
14149
14157
  let sleepScheduler;
14150
14158
  try {
14151
- mcpManager = await connectMcpServers({
14152
- servers: config.mcpServers,
14153
- workspace,
14154
- clientFactory: options.mcpClientFactory ?? connectSdkMcpClient
14155
- });
14156
- diagnostics.push(...mcpManager.diagnostics);
14157
14159
  const syncMcpTools = () => {
14158
14160
  for (const tool of mcpTools) remove(tools, tool);
14159
14161
  mcpTools.length = 0;
@@ -14168,14 +14170,25 @@ async function createProductionRuntime(options) {
14168
14170
  }
14169
14171
  if (harnessCreated) harness.replaceMainTools(tools);
14170
14172
  };
14171
- syncMcpTools();
14173
+ void mcpReady.then((manager) => {
14174
+ if (mcpDiscarded) {
14175
+ void manager.close().catch(() => void 0);
14176
+ return;
14177
+ }
14178
+ mcpManager = manager;
14179
+ diagnostics.push(...manager.diagnostics);
14180
+ syncMcpTools();
14181
+ }, (error) => {
14182
+ diagnostics.push(`MCP servers could not start: ${message(error)}`);
14183
+ });
14172
14184
  const skills = new SkillRegistry({
14173
14185
  globalRoots: [join17(home, ".flavor-code", "skills")],
14174
14186
  projectRoots: [join17(workspace, ".flavor", "skills"), ...pluginSkillRoots],
14175
14187
  authorizeResource: async () => true,
14176
14188
  disabledNames: config.skills.disabled
14177
14189
  });
14178
- await skills.discover();
14190
+ const skillsReady = skills.discover();
14191
+ skillsReady.catch(() => void 0);
14179
14192
  tools.push(createSkillResourceTool(skills));
14180
14193
  const flavor = await optionalText2(join17(workspace, "FLAVOR.md"));
14181
14194
  let memoryContext;
@@ -14203,6 +14216,7 @@ async function createProductionRuntime(options) {
14203
14216
  let sessionId = recovered?.sessionId ?? `session-${(/* @__PURE__ */ new Date()).toISOString().replace(/[^0-9]/g, "").slice(0, 17)}-${randomUUID10().slice(0, 8)}`;
14204
14217
  setUsageSession(sessionId);
14205
14218
  ideSessionId = sessionId;
14219
+ await ideReady;
14206
14220
  await ide.startSession(sessionId);
14207
14221
  let createdAt = recovered?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString();
14208
14222
  let memoryLifecycle = recovered?.memory ?? { status: "active", taskId: createMemoryTaskId(), messageStart: 0 };
@@ -14332,7 +14346,7 @@ async function createProductionRuntime(options) {
14332
14346
  platform: process.platform,
14333
14347
  osVersion: `${osVersion()} ${osRelease()}`,
14334
14348
  shell: environment.ComSpec ?? environment.SHELL ?? "unknown",
14335
- isGitRepository: await detectGitRepository(workspace)
14349
+ isGitRepository: await gitRepository
14336
14350
  });
14337
14351
  const createContext = (agent, agentTools, contextModelId, parentContext) => {
14338
14352
  const taskState = serializedTaskState();
@@ -14392,6 +14406,7 @@ async function createProductionRuntime(options) {
14392
14406
  showWarnings: config.hallucination.showWarnings,
14393
14407
  evaluationTimeoutMs: config.hallucination.evaluationTimeoutMs
14394
14408
  });
14409
+ await skillsReady;
14395
14410
  harness = new LocalHarness({
14396
14411
  registry,
14397
14412
  hooks,
@@ -14819,7 +14834,7 @@ async function createProductionRuntime(options) {
14819
14834
  runGoal: (goal, signal) => persistEach(runGoalSession(goalOrchestrator, goal, signal), persist),
14820
14835
  mcp: async (command, signal) => {
14821
14836
  signal.throwIfAborted();
14822
- const manager = mcpManager;
14837
+ const manager = await mcpReady;
14823
14838
  if (command.action === "status") return redactSecrets(formatMcpStatus(manager), secrets);
14824
14839
  if (command.action === "tools") return redactSecrets(formatMcpTools(manager, command.target), secrets);
14825
14840
  if (command.action === "reconnect") {
@@ -15128,6 +15143,7 @@ ${renderMemoryDocument(entries)}`;
15128
15143
  async dispose() {
15129
15144
  if (disposed) return;
15130
15145
  disposed = true;
15146
+ mcpDiscarded = true;
15131
15147
  await sleepScheduler?.dispose();
15132
15148
  await memoryCoordinator?.flush();
15133
15149
  await persist();
@@ -15140,6 +15156,7 @@ ${renderMemoryDocument(entries)}`;
15140
15156
  }
15141
15157
  };
15142
15158
  } catch (primaryError) {
15159
+ mcpDiscarded = true;
15143
15160
  memoryReviews.dispose();
15144
15161
  try {
15145
15162
  if (ideSessionId !== void 0) await ide.endSession(ideSessionId);
@@ -4,7 +4,7 @@ import {
4
4
  message,
5
5
  redactErrorText,
6
6
  redactSecrets
7
- } from "./chunk-RYDCJHXW.js";
7
+ } from "./chunk-5RHJ3PQN.js";
8
8
 
9
9
  // src/rpc/server.ts
10
10
  import { createInterface } from "readline";
package/dist/cli.js CHANGED
@@ -3,7 +3,7 @@ import { createRequire } from "node:module"; const require = createRequire(impor
3
3
  import {
4
4
  FlavorRpcServer,
5
5
  TraceRecorder
6
- } from "./chunk-CXSXBPD6.js";
6
+ } from "./chunk-WN2EZV3Y.js";
7
7
  import {
8
8
  staticTaskLines
9
9
  } from "./chunk-KKIBYDJI.js";
@@ -20,7 +20,7 @@ import {
20
20
  message,
21
21
  packageVersion,
22
22
  redactErrorText
23
- } from "./chunk-RYDCJHXW.js";
23
+ } from "./chunk-5RHJ3PQN.js";
24
24
  import {
25
25
  McpServerConfigSchema,
26
26
  McpServerNameSchema,
@@ -771,7 +771,7 @@ function createProgram() {
771
771
  const [{ render, AlternateScreen }, { createElement }, { App }] = await Promise.all([
772
772
  import("./claude-ink-WPWPEL5A.js"),
773
773
  import("react"),
774
- import("./app-WRTEXGA6.js")
774
+ import("./app-R3SDG2OH.js")
775
775
  ]);
776
776
  const instance = await render(createElement(
777
777
  AlternateScreen,
@@ -14914,9 +14914,17 @@ async function createProductionRuntime(options) {
14914
14914
  const home = resolve23(options.home ?? homedir());
14915
14915
  const environment = options.environment ?? process.env;
14916
14916
  const ide = new FlavorIdeClient({ workspace, home, environment });
14917
+ const ideReady = ide.initialize();
14918
+ const gitRepository = detectGitRepository(workspace);
14917
14919
  const loaded = await loadConfig({ cwd: workspace, home, environment });
14918
- await ide.initialize();
14919
14920
  const config = loaded.config;
14921
+ const mcpReady = connectMcpServers({
14922
+ servers: config.mcpServers,
14923
+ workspace,
14924
+ clientFactory: options.mcpClientFactory ?? connectSdkMcpClient
14925
+ });
14926
+ mcpReady.catch(() => void 0);
14927
+ let mcpDiscarded = false;
14920
14928
  const sessionStore = new SessionStore({ workspace, maxSessions: config.maxSessions });
14921
14929
  const memoryStore = config.memory.enabled ? new MemoryStore({
14922
14930
  workspace,
@@ -15144,12 +15152,6 @@ async function createProductionRuntime(options) {
15144
15152
  await pluginHost.loadAll();
15145
15153
  let sleepScheduler;
15146
15154
  try {
15147
- mcpManager = await connectMcpServers({
15148
- servers: config.mcpServers,
15149
- workspace,
15150
- clientFactory: options.mcpClientFactory ?? connectSdkMcpClient
15151
- });
15152
- diagnostics.push(...mcpManager.diagnostics);
15153
15155
  const syncMcpTools = () => {
15154
15156
  for (const tool of mcpTools) remove(tools, tool);
15155
15157
  mcpTools.length = 0;
@@ -15164,14 +15166,25 @@ async function createProductionRuntime(options) {
15164
15166
  }
15165
15167
  if (harnessCreated) harness.replaceMainTools(tools);
15166
15168
  };
15167
- syncMcpTools();
15169
+ void mcpReady.then((manager) => {
15170
+ if (mcpDiscarded) {
15171
+ void manager.close().catch(() => void 0);
15172
+ return;
15173
+ }
15174
+ mcpManager = manager;
15175
+ diagnostics.push(...manager.diagnostics);
15176
+ syncMcpTools();
15177
+ }, (error) => {
15178
+ diagnostics.push(`MCP servers could not start: ${message(error)}`);
15179
+ });
15168
15180
  const skills = new SkillRegistry({
15169
15181
  globalRoots: [join21(home, ".flavor-code", "skills")],
15170
15182
  projectRoots: [join21(workspace, ".flavor", "skills"), ...pluginSkillRoots],
15171
15183
  authorizeResource: async () => true,
15172
15184
  disabledNames: config.skills.disabled
15173
15185
  });
15174
- await skills.discover();
15186
+ const skillsReady = skills.discover();
15187
+ skillsReady.catch(() => void 0);
15175
15188
  tools.push(createSkillResourceTool(skills));
15176
15189
  const flavor = await optionalText2(join21(workspace, "FLAVOR.md"));
15177
15190
  let memoryContext;
@@ -15199,6 +15212,7 @@ async function createProductionRuntime(options) {
15199
15212
  let sessionId = recovered?.sessionId ?? `session-${(/* @__PURE__ */ new Date()).toISOString().replace(/[^0-9]/g, "").slice(0, 17)}-${randomUUID12().slice(0, 8)}`;
15200
15213
  setUsageSession(sessionId);
15201
15214
  ideSessionId = sessionId;
15215
+ await ideReady;
15202
15216
  await ide.startSession(sessionId);
15203
15217
  let createdAt = recovered?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString();
15204
15218
  let memoryLifecycle = recovered?.memory ?? { status: "active", taskId: createMemoryTaskId(), messageStart: 0 };
@@ -15328,7 +15342,7 @@ async function createProductionRuntime(options) {
15328
15342
  platform: process.platform,
15329
15343
  osVersion: `${osVersion()} ${osRelease()}`,
15330
15344
  shell: environment.ComSpec ?? environment.SHELL ?? "unknown",
15331
- isGitRepository: await detectGitRepository(workspace)
15345
+ isGitRepository: await gitRepository
15332
15346
  });
15333
15347
  const createContext = (agent, agentTools, contextModelId, parentContext) => {
15334
15348
  const taskState = serializedTaskState();
@@ -15388,6 +15402,7 @@ async function createProductionRuntime(options) {
15388
15402
  showWarnings: config.hallucination.showWarnings,
15389
15403
  evaluationTimeoutMs: config.hallucination.evaluationTimeoutMs
15390
15404
  });
15405
+ await skillsReady;
15391
15406
  harness = new LocalHarness({
15392
15407
  registry,
15393
15408
  hooks,
@@ -15815,7 +15830,7 @@ async function createProductionRuntime(options) {
15815
15830
  runGoal: (goal, signal) => persistEach(runGoalSession(goalOrchestrator, goal, signal), persist),
15816
15831
  mcp: async (command, signal) => {
15817
15832
  signal.throwIfAborted();
15818
- const manager = mcpManager;
15833
+ const manager = await mcpReady;
15819
15834
  if (command.action === "status") return redactSecrets(formatMcpStatus(manager), secrets);
15820
15835
  if (command.action === "tools") return redactSecrets(formatMcpTools(manager, command.target), secrets);
15821
15836
  if (command.action === "reconnect") {
@@ -16124,6 +16139,7 @@ ${renderMemoryDocument(entries)}`;
16124
16139
  async dispose() {
16125
16140
  if (disposed) return;
16126
16141
  disposed = true;
16142
+ mcpDiscarded = true;
16127
16143
  await sleepScheduler?.dispose();
16128
16144
  await memoryCoordinator?.flush();
16129
16145
  await persist();
@@ -16136,6 +16152,7 @@ ${renderMemoryDocument(entries)}`;
16136
16152
  }
16137
16153
  };
16138
16154
  } catch (primaryError) {
16155
+ mcpDiscarded = true;
16139
16156
  memoryReviews.dispose();
16140
16157
  try {
16141
16158
  if (ideSessionId !== void 0) await ide.endSession(ideSessionId);
package/dist/sdk/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  FlavorRpcServer,
5
5
  TraceRecordSchema,
6
6
  TraceRecorder
7
- } from "../chunk-CXSXBPD6.js";
7
+ } from "../chunk-WN2EZV3Y.js";
8
8
  import {
9
9
  AgentMessageQueue,
10
10
  DockerExecutionEnvironment,
@@ -13,7 +13,7 @@ import {
13
13
  WorkspaceCheckpointStore,
14
14
  buildDockerInvocation,
15
15
  createProductionRuntime
16
- } from "../chunk-RYDCJHXW.js";
16
+ } from "../chunk-5RHJ3PQN.js";
17
17
  import "../chunk-HFR2WS6T.js";
18
18
  import "../chunk-N2S7USST.js";
19
19
  import "../chunk-S32JRDZK.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flavor-code",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "author": "YachuanWzh",
5
5
  "type": "module",
6
6
  "publishConfig": {