Skip to content
Merged
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
19,053 changes: 10,091 additions & 8,962 deletions cloudflare-deploy-infra/dispatcher/worker-configuration.d.ts

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion cloudflare-gastown/container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ RUN apt-get update && \
# Install Kilo CLI globally via npm (needs real Node.js runtime).
# npm's global install does not resolve optionalDependencies, so we must
# explicitly install the platform-specific binary package alongside the CLI.
RUN npm install -g @kilocode/cli @kilocode/cli-linux-x64
# Also install @kilocode/plugin globally so repo-local tools (e.g.
# .opencode/tool/*.ts) can resolve it without a local node_modules.
RUN npm install -g @kilocode/cli @kilocode/cli-linux-x64 @kilocode/plugin

# Create workspace directories
RUN mkdir -p /workspace/rigs /app
Expand Down
10 changes: 5 additions & 5 deletions cloudflare-gastown/container/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cloudflare-gastown/container/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
"typecheck": "bun x tsc --noEmit"
},
"dependencies": {
"@kilocode/plugin": "1.0.23",
"@kilocode/sdk": "1.0.23",
"hono": "^4.11.4",
"zod": "^4.3.5"
},
"devDependencies": {
"@opencode-ai/plugin": "^1.1.64",
"@opencode-ai/sdk": "^1.1.64",
"@types/bun": "^1.2.17",
"typescript": "^5.9.3",
"vitest": "^3.2.4"
Expand Down
28 changes: 28 additions & 0 deletions cloudflare-gastown/container/plugin/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,34 @@ export class GastownClient {
body: JSON.stringify(input),
});
}

async getMoleculeCurrentStep(): Promise<{
moleculeId: string;
currentStep: number;
totalSteps: number;
step: { title: string; instructions: string };
status: string;
} | null> {
try {
return await this.request(this.rigPath(`/agents/${this.agentId}/molecule/current`));
} catch (err) {
if (err instanceof GastownApiError && err.status === 404) return null;
throw err;
}
}

async advanceMoleculeStep(summary: string): Promise<{
moleculeId: string;
previousStep: number;
currentStep: number;
totalSteps: number;
completed: boolean;
}> {
return this.request(this.rigPath(`/agents/${this.agentId}/molecule/advance`), {
method: 'POST',
body: JSON.stringify({ summary }),
});
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion cloudflare-gastown/container/plugin/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Plugin } from '@opencode-ai/plugin';
import type { Plugin } from '@kilocode/plugin';
import { createClientFromEnv, createMayorClientFromEnv, GastownApiError } from './client';
import { createTools } from './tools';
import { createMayorTools } from './mayor-tools';
Expand Down
2 changes: 1 addition & 1 deletion cloudflare-gastown/container/plugin/mayor-tools.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { tool } from '@opencode-ai/plugin';
import { tool } from '@kilocode/plugin';
import type { MayorGastownClient } from './client';

function parseJsonObject(value: string, label: string): Record<string, unknown> {
Expand Down
8 changes: 4 additions & 4 deletions cloudflare-gastown/container/plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "opencode-gastown",
"name": "gastown-plugin",
"version": "0.1.0",
"type": "module",
"private": true,
"description": "OpenCode plugin exposing Gastown tools to agents",
"description": "Kilo plugin exposing Gastown tools to agents",
"main": "index.ts",
"dependencies": {
"@opencode-ai/plugin": "^1.1.64",
"@opencode-ai/sdk": "^1.1.64",
"@kilocode/plugin": "^1.0.23",
"@kilocode/sdk": "^1.0.23",
"zod": "^4.3.5"
}
}
4 changes: 2 additions & 2 deletions cloudflare-gastown/container/plugin/tools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
import type { GastownClient } from './client';
import type { Bead, Mail, PrimeContext } from './types';

// Mock the @opencode-ai/plugin module to avoid its broken ESM import chain.
// Mock the @kilocode/plugin module to avoid its broken ESM import chain.
// The real `tool` is a passthrough that attaches `tool.schema = z`.
import { z } from 'zod';

Expand All @@ -11,7 +11,7 @@ function toolFn(def: Record<string, unknown>) {
}
toolFn.schema = z;

vi.mock('@opencode-ai/plugin', () => ({
vi.mock('@kilocode/plugin', () => ({
tool: toolFn,
}));

Expand Down
34 changes: 33 additions & 1 deletion cloudflare-gastown/container/plugin/tools.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { tool } from '@opencode-ai/plugin';
import { tool } from '@kilocode/plugin';
import type { GastownClient } from './client';

function parseJsonArg(value: string, label: string): unknown {
Expand Down Expand Up @@ -152,5 +152,37 @@ export function createTools(client: GastownClient) {
return 'Checkpoint saved.';
},
}),

gt_mol_current: tool({
description:
'Get the current molecule step for your hooked bead. Returns the step title, ' +
'instructions, step number (N of M), and molecule status. ' +
'Returns null if no molecule is attached to your current bead.',
args: {},
async execute() {
const step = await client.getMoleculeCurrentStep();
if (!step) return 'No molecule attached to your current bead.';
return JSON.stringify(step, null, 2);
},
}),

gt_mol_advance: tool({
description:
'Complete the current molecule step and advance to the next one. ' +
'Provide a summary of what you accomplished in this step. ' +
'If this is the final step, the molecule is marked as completed.',
args: {
summary: tool.schema
.string()
.describe('Brief summary of what you accomplished in this step'),
},
async execute(args) {
const result = await client.advanceMoleculeStep(args.summary);
if (result.completed) {
return `Molecule completed! All ${result.totalSteps} steps are done.`;
}
return `Advanced to step ${result.currentStep + 1} of ${result.totalSteps}.`;
},
}),
};
}
Loading