Skip to content

Commit d7407b0

Browse files
authored
feat: release experimental features (#569)
* feat: release experimental features * refactor: remove redundant goal runtime gate * refactor: remove unused skill flag plumbing * feat: keep micro compaction opt-out
1 parent db82e33 commit d7407b0

48 files changed

Lines changed: 199 additions & 515 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@moonshot-ai/agent-core": minor
3+
"@moonshot-ai/kimi-code": minor
4+
---
5+
6+
Enable micro compaction by default while keeping its opt-out flag.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@moonshot-ai/agent-core": minor
3+
"@moonshot-ai/kimi-code": minor
4+
---
5+
6+
Make goals, background questions, and sub-skill discovery available without experimental opt-ins.

.changeset/template-agent-swarm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"@moonshot-ai/kimi-code": minor
66
---
77

8-
Add swarm agent runs with SDK/TUI controls, live progress, and rate-limit-aware retries.
8+
Add the `/swarm` command for running agent swarms with live progress and rate-limit-aware retries.

apps/kimi-code/src/cli/goal-prompt.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,7 @@ const GOAL_PREFIX = /^\/goal(\s|$)/;
4848
* prompt). Non-create goal subcommands are not supported headless and fall
4949
* through to normal prompt handling.
5050
*/
51-
export function parseHeadlessGoalCreate(
52-
prompt: string,
53-
flagEnabled: boolean,
54-
): HeadlessGoalCreate | undefined {
55-
if (!flagEnabled) return undefined;
51+
export function parseHeadlessGoalCreate(prompt: string): HeadlessGoalCreate | undefined {
5652
const trimmed = prompt.trim();
5753
if (!GOAL_PREFIX.test(trimmed)) return undefined;
5854
const args = trimmed.replace(/^\/goal/, '').trim();

apps/kimi-code/src/cli/run-prompt.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
import { resolve } from 'pathe';
2121

2222
import { CLI_SHUTDOWN_TIMEOUT_MS } from '#/constant/app';
23-
import { experimentalFeatureMap } from '#/utils/experimental-features';
2423

2524
import type { CLIOptions, PromptOutputFormat } from './options';
2625
import {
@@ -148,8 +147,7 @@ export async function runPrompt(
148147
// the turn-run alive across continuation turns, so the normal prompt-turn
149148
// waiter blocks until the goal is terminal; we then emit a summary and set a
150149
// distinct exit code.
151-
const flagMap = experimentalFeatureMap(await harness.getExperimentalFeatures());
152-
const goalCreate = parseHeadlessGoalCreate(opts.prompt!, flagMap['goal_command'] === true);
150+
const goalCreate = parseHeadlessGoalCreate(opts.prompt!);
153151
if (goalCreate !== undefined) {
154152
await runHeadlessGoal(session, goalCreate, goalModel, outputFormat, stdout, stderr);
155153
} else {

apps/kimi-code/src/tui/commands/registry.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ export const BUILTIN_SLASH_COMMANDS = [
8282
aliases: [],
8383
description: 'Toggle swarm mode or run one task in swarm mode',
8484
priority: 100,
85-
experimentalFlag: 'agent_swarm',
8685
completeArgs: swarmArgumentCompletions,
8786
availability: 'idle-only',
8887
},
@@ -179,7 +178,6 @@ export const BUILTIN_SLASH_COMMANDS = [
179178
aliases: [],
180179
description: 'Start or manage an autonomous goal',
181180
priority: 80,
182-
experimentalFlag: 'goal_command',
183181
// No argumentHint: the menu description stays as short as every other
184182
// command's. The subcommands (status/pause/resume/cancel/replace) surface in
185183
// the argument autocomplete list once the user types `/goal ` (see

apps/kimi-code/src/tui/kimi-tui.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,9 +1045,7 @@ export class KimiTUI {
10451045
async syncRuntimeState(session: Session = this.requireSession()): Promise<void> {
10461046
const [status, goalResult] = await Promise.all([
10471047
session.getStatus(),
1048-
isExperimentalFlagEnabled('goal_command')
1049-
? session.getGoal()
1050-
: Promise.resolve({ goal: null }),
1048+
session.getGoal(),
10511049
]);
10521050
this.setAppState({
10531051
sessionId: session.id,

apps/kimi-code/test/cli/goal-prompt.test.ts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,15 @@ describe('goalExitCode', () => {
3636
});
3737

3838
describe('parseHeadlessGoalCreate', () => {
39-
it('returns undefined when the flag is disabled', () => {
40-
expect(parseHeadlessGoalCreate('/goal Ship feature X', false)).toBeUndefined();
41-
});
42-
4339
it('parses a create command into objective + replace', () => {
44-
const result = parseHeadlessGoalCreate('/goal Ship feature X', true);
40+
const result = parseHeadlessGoalCreate('/goal Ship feature X');
4541
expect(result).toEqual({ objective: 'Ship feature X', replace: false });
4642
});
4743

4844
it('returns undefined for non-goal prompts and non-create subcommands', () => {
49-
expect(parseHeadlessGoalCreate('say hello', true)).toBeUndefined();
50-
expect(parseHeadlessGoalCreate('/goal status', true)).toBeUndefined();
51-
expect(parseHeadlessGoalCreate('/goal pause', true)).toBeUndefined();
45+
expect(parseHeadlessGoalCreate('say hello')).toBeUndefined();
46+
expect(parseHeadlessGoalCreate('/goal status')).toBeUndefined();
47+
expect(parseHeadlessGoalCreate('/goal pause')).toBeUndefined();
5248
});
5349
});
5450

@@ -106,7 +102,7 @@ const mocks = vi.hoisted(() => {
106102
session,
107103
eventHandlers,
108104
mainEvent,
109-
experimentalFeatures: [{ id: 'goal_command', enabled: true }],
105+
experimentalFeatures: [{ id: 'micro_compaction', enabled: true }],
110106
sessions: [] as Array<{ readonly id: string; readonly workDir: string }>,
111107
};
112108
});
@@ -164,7 +160,7 @@ describe('runPrompt headless goal mode', () => {
164160

165161
beforeEach(() => {
166162
savedExitCode = process.exitCode;
167-
mocks.experimentalFeatures = [{ id: 'goal_command', enabled: true }];
163+
mocks.experimentalFeatures = [{ id: 'micro_compaction', enabled: true }];
168164
mocks.sessions = [];
169165
mocks.session.createGoal.mockClear();
170166
mocks.session.getStatus.mockResolvedValue({ permission: 'auto', model: 'k2' } as never);
@@ -233,7 +229,7 @@ describe('runPrompt headless goal mode', () => {
233229
expect(stdout.text()).not.toContain('"goalId":null');
234230
});
235231

236-
it('treats /goal as a normal prompt when the flag is disabled', async () => {
232+
it('creates a headless goal without reading experimental features', async () => {
237233
mocks.experimentalFeatures = [];
238234
const stdout = writer();
239235
const stderr = writer();
@@ -242,8 +238,8 @@ describe('runPrompt headless goal mode', () => {
242238
stderr,
243239
process: { once: () => {}, off: () => {}, exit: () => undefined as never },
244240
});
245-
expect(mocks.session.createGoal).not.toHaveBeenCalled();
246-
expect(mocks.session.prompt).toHaveBeenCalled();
241+
expect(mocks.session.createGoal).toHaveBeenCalled();
242+
expect(mocks.session.prompt).toHaveBeenCalledWith('Ship feature X');
247243
});
248244

249245
it('validates the resumed session model before creating a headless goal', async () => {

apps/kimi-code/test/tui/commands/experiments.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ function feature(
1515
overrides: Partial<ExperimentalFeatureState> = {},
1616
): ExperimentalFeatureState {
1717
return {
18-
id: 'goal_command',
19-
title: 'Goal command',
20-
description: 'Enable goal mode.',
21-
surface: 'both',
22-
env: 'KIMI_CODE_EXPERIMENTAL_GOAL_COMMAND',
23-
defaultEnabled: false,
24-
enabled: false,
18+
id: 'micro_compaction',
19+
title: 'Micro compaction',
20+
description: 'Trim older tool results.',
21+
surface: 'core',
22+
env: 'KIMI_CODE_EXPERIMENTAL_MICRO_COMPACTION',
23+
defaultEnabled: true,
24+
enabled: true,
2525
source: 'default',
2626
...overrides,
2727
};
@@ -40,7 +40,7 @@ function makeHost() {
4040
harness: {
4141
setConfig: vi.fn(async () => ({ providers: {} })),
4242
getExperimentalFeatures: vi.fn(async () => [
43-
feature({ enabled: true, source: 'config', configValue: true }),
43+
feature({ enabled: false, source: 'config', configValue: false }),
4444
]),
4545
},
4646
session,
@@ -77,14 +77,14 @@ describe('experimental feature command handlers', () => {
7777
const host = makeHost();
7878

7979
await applyExperimentalFeatureChanges(host, [
80-
{ id: 'goal_command', enabled: true },
80+
{ id: 'micro_compaction', enabled: false },
8181
]);
8282

8383
expect(host.harness.setConfig).toHaveBeenCalledWith({
84-
experimental: { 'goal_command': true },
84+
experimental: { 'micro_compaction': false },
8585
});
8686
expect(host.harness.getExperimentalFeatures).toHaveBeenCalledOnce();
87-
expect(isExperimentalFlagEnabled('goal_command')).toBe(true);
87+
expect(isExperimentalFlagEnabled('micro_compaction')).toBe(false);
8888
expect(host.refreshSlashCommandAutocomplete).toHaveBeenCalled();
8989
expect(host.restoreEditor).toHaveBeenCalled();
9090
expect(host.session.reloadSession).toHaveBeenCalledOnce();

apps/kimi-code/test/tui/commands/goal.test.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,6 @@ describe('dispatchInput /goal integration', () => {
690690
});
691691

692692
it('routes /goal through the real resolver, creates the goal, and sends the objective', async () => {
693-
setExperimentalFeatures([{ id: 'goal_command', enabled: true }]);
694693
const { host, session } = makeHost();
695694

696695
dispatchInput(host, '/goal Ship feature X');
@@ -703,18 +702,6 @@ describe('dispatchInput /goal integration', () => {
703702
expect(host.sendNormalUserInput).toHaveBeenCalledWith('Ship feature X');
704703
expect(host.sendNormalUserInput).not.toHaveBeenCalledWith('/goal Ship feature X');
705704
});
706-
707-
it('treats /goal as a normal message when the flag is disabled', async () => {
708-
setExperimentalFeatures([]);
709-
const { host, session } = makeHost();
710-
711-
dispatchInput(host, '/goal Ship feature X');
712-
713-
await vi.waitFor(() => {
714-
expect(host.sendNormalUserInput).toHaveBeenCalledWith('/goal Ship feature X');
715-
});
716-
expect(session.createGoal).not.toHaveBeenCalled();
717-
});
718705
});
719706

720707
describe('goalArgumentCompletions', () => {

0 commit comments

Comments
 (0)