Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
# build.sh — kimi-code 빌드 및 배포 자동화
set -e
cd "$HOME/.kimi-code/src/kimi-code"

# Node.js 24.x 활성화
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
nvm use 24

# 의존성 설치 및 빌드
echo "📦 Installing dependencies..."
pnpm install

echo "🔨 Building..."
pnpm build

# 빌드 산출물 확인
echo "🚀 Verifying build output..."
if [ ! -f apps/kimi-code/dist/main.mjs ]; then
echo "❌ Build failed! main.mjs not found."
exit 1
fi

# wrapper가 이미 올바른 경로指向하는지 확인
if [ ! -x "$HOME/.kimi-code/bin/kimi" ]; then
echo "⚠️ Wrapper not found, creating..."
cat > "$HOME/.kimi-code/bin/kimi" << 'WRAPPER'
#!/bin/bash
cd "$HOME/.kimi-code/src/kimi-code/apps/kimi-code"
exec node dist/main.mjs "$@"
WRAPPER
chmod +x "$HOME/.kimi-code/bin/kimi"
fi

# 빌드 검증
echo "✅ Build complete. Testing..."
"$HOME/.kimi-code/bin/kimi" --version
6 changes: 5 additions & 1 deletion packages/agent-core/src/agent/swarm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ export type SwarmModeTrigger = 'manual' | 'task' | 'tool';
export class SwarmMode {
protected active: SwarmModeTrigger | null = null;

constructor(protected readonly agent: Agent) {}
constructor(protected readonly agent: Agent) {
if (agent.kimiConfig?.defaultSwarmMode === true) {
this.active = 'manual';
Comment on lines +17 to +18

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Initialize default swarm mode through the normal entry path

When default_swarm_mode is true this only flips active to manual, but skips the side effects in enter('manual'): the swarm-mode system reminder is never appended, no swarm_mode.enter record is written, and no status update is emitted. In a fresh session the UI/RPC reports swarm mode as active and AgentSwarm approval is relaxed, but the model never receives the workflow instructions that /swarm on would inject, so the new default does not actually enable automatic parallel delegation.

Useful? React with 👍 / 👎.

}
}

enter(trigger: SwarmModeTrigger): void {
if (this.active !== null) return;
Expand Down
4 changes: 4 additions & 0 deletions packages/agent-core/src/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ export const KimiConfigSchema = z.object({
extraSkillDirs: z.array(z.string()).optional(),
loopControl: LoopControlSchema.optional(),
background: BackgroundConfigSchema.optional(),
defaultSwarmMode: z.boolean().optional(),
subagentModel: z.string().optional(),
experimental: ExperimentalConfigSchema.optional(),
telemetry: z.boolean().optional(),
raw: z.record(z.string(), z.unknown()).optional(),
Expand Down Expand Up @@ -257,6 +259,8 @@ export const KimiConfigPatchSchema = z
extraSkillDirs: z.array(z.string()).optional(),
loopControl: LoopControlPatchSchema.optional(),
background: BackgroundConfigPatchSchema.optional(),
defaultSwarmMode: z.boolean().optional(),
subagentModel: z.string().optional(),
experimental: ExperimentalConfigPatchSchema.optional(),
telemetry: z.boolean().optional(),
})
Expand Down
2 changes: 2 additions & 0 deletions packages/agent-core/src/config/toml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,8 @@ export function configToTomlData(config: KimiConfig): Record<string, unknown> {
'defaultThinking',
'defaultPermissionMode',
'defaultPlanMode',
'defaultSwarmMode',
'subagentModel',
'mergeAllAvailableSkills',
'extraSkillDirs',
'telemetry',
Expand Down
13 changes: 8 additions & 5 deletions packages/agent-core/src/session/subagent-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ export class SessionSubagentHost {
private readonly ownerAgentId: string,
) {}

private resolveSubagentModel(parent: Agent): string | undefined {
return this.session.options.config?.subagentModel ?? parent.config.modelAlias;
}

async spawn(options: SpawnSubagentOptions): Promise<SubagentHandle> {
options.signal.throwIfAborted();

Expand Down Expand Up @@ -143,7 +147,7 @@ export class SessionSubagentHost {
const completion = this.runWithActiveChild(agentId, options, async (runOptions) => {
this.emitSubagentSpawned(parent, agentId, profileName, runOptions);
try {
child.config.update({ modelAlias: parent.config.modelAlias });
child.config.update({ modelAlias: this.resolveSubagentModel(parent) });
return await this.runPromptTurn(parent, agentId, child, profileName, runOptions);
} catch (error) {
this.emitSubagentFailed(parent, agentId, runOptions, error);
Expand All @@ -159,7 +163,7 @@ export class SessionSubagentHost {
const completion = this.runWithActiveChild(agentId, options, async (runOptions) => {
try {
runOptions.signal.throwIfAborted();
child.config.update({ modelAlias: parent.config.modelAlias });
child.config.update({ modelAlias: this.resolveSubagentModel(parent) });
this.emitSubagentStarted(parent, agentId);
const turnId = child.turn.retry('agent-host');
if (turnId === null) {
Expand Down Expand Up @@ -220,7 +224,7 @@ export class SessionSubagentHost {
);

child.config.update({
modelAlias: parent.config.modelAlias,
modelAlias: this.resolveSubagentModel(parent),
thinkingLevel: parent.config.thinkingLevel,
systemPrompt: parent.config.systemPrompt,
});
Expand Down Expand Up @@ -355,10 +359,9 @@ export class SessionSubagentHost {
child: Agent,
profile: ResolvedAgentProfile,
): Promise<void> {
// A subagent always inherits the parent agent's model.
child.config.update({
cwd: parent.config.cwd,
modelAlias: parent.config.modelAlias,
modelAlias: this.resolveSubagentModel(parent),
thinkingLevel: parent.config.thinkingLevel,
});

Expand Down