Skip to content

Commit 3c630d7

Browse files
authored
Merge pull request #8224 from continuedev/dallin/workflow-to-agent
feat: rename workflows to agent files
2 parents 32d7ba2 + 2276c4e commit 3c630d7

29 files changed

+871
-874
lines changed

core/config/markdown/loadMarkdownRules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export async function loadMarkdownRules(ide: IDE): Promise<{
3737
});
3838
rules.push({
3939
...rule,
40-
source: "agent-file",
40+
source: "agentFile",
4141
sourceFile: agentFileUri,
4242
alwaysApply: true,
4343
});

core/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1852,7 +1852,7 @@ export type RuleSource =
18521852
| "colocated-markdown"
18531853
| "json-systemMessage"
18541854
| ".continuerules"
1855-
| "agent-file";
1855+
| "agentFile";
18561856

18571857
export interface RuleWithSource {
18581858
name?: string;

core/llm/rules/rules-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function getRuleSourceDisplayName(rule: RuleWithSource): string {
2626
return "Base System Plan Message";
2727
case "model-options-chat":
2828
return "Base System Chat Message";
29-
case "agent-file":
29+
case "agentFile":
3030
if (rule.sourceFile) {
3131
return getLastNPathParts(rule.sourceFile, 2);
3232
} else {

extensions/cli/src/__mocks__/services/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ export const SERVICE_NAMES = {
2626
CHAT_HISTORY: "chatHistory",
2727
UPDATE: "update",
2828
STORAGE_SYNC: "storageSync",
29-
WORKFLOW: "workflow",
29+
AGENT_FILE: "agentFile",
3030
} as const;

extensions/cli/src/commands/BaseCommandOptions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ export interface BaseCommandOptions {
2121
ask?: string[];
2222
/** Array of tools to exclude from use (--exclude) */
2323
exclude?: string[];
24-
/** Workflow slug from the hub (--workflow) */
25-
workflow?: string;
24+
/** Agent file slug from the hub (--agent) */
25+
agent?: string;
2626
}
2727

2828
/**

extensions/cli/src/commands/chat.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import { sentryService } from "../sentry.js";
1313
import { initializeServices, services } from "../services/index.js";
1414
import { serviceContainer } from "../services/ServiceContainer.js";
1515
import {
16+
AgentFileServiceState,
1617
ModelServiceState,
1718
SERVICE_NAMES,
18-
WorkflowServiceState,
1919
} from "../services/types.js";
2020
import {
2121
loadSession,
@@ -478,11 +478,11 @@ async function runHeadlessMode(
478478
const { processAndCombinePrompts } = await import(
479479
"../util/promptProcessor.js"
480480
);
481-
const workflowState = await serviceContainer.get<WorkflowServiceState>(
482-
SERVICE_NAMES.WORKFLOW,
481+
const agentFileState = await serviceContainer.get<AgentFileServiceState>(
482+
SERVICE_NAMES.AGENT_FILE,
483483
);
484484
const initialPrompt =
485-
`${workflowState?.workflowFile?.prompt ?? ""}\n\n${prompt ?? ""}`.trim() ||
485+
`${agentFileState?.agentFile?.prompt ?? ""}\n\n${prompt ?? ""}`.trim() ||
486486
undefined;
487487
const initialUserInput = await processAndCombinePrompts(
488488
options.prompt,
@@ -549,12 +549,12 @@ export async function chat(prompt?: string, options: ChatOptions = {}) {
549549
toolPermissionOverrides: permissionOverrides,
550550
});
551551

552-
const workflowState = await serviceContainer.get<WorkflowServiceState>(
553-
SERVICE_NAMES.WORKFLOW,
552+
const agentFileState = await serviceContainer.get<AgentFileServiceState>(
553+
SERVICE_NAMES.AGENT_FILE,
554554
);
555555

556556
const initialPrompt =
557-
`${workflowState?.workflowFile?.prompt ?? ""}\n\n${prompt ?? ""}`.trim() ||
557+
`${agentFileState?.agentFile?.prompt ?? ""}\n\n${prompt ?? ""}`.trim() ||
558558
undefined;
559559

560560
// Start TUI with skipOnboarding since we already handled it

extensions/cli/src/configEnhancer.test.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,23 @@ vi.mock("./hubLoader.js", () => ({
2121
modelProcessor: {},
2222
}));
2323

24-
// Mock the service container to provide empty workflow state
24+
// Mock the service container to provide empty agent file state
2525
vi.mock("./services/ServiceContainer.js", () => ({
2626
serviceContainer: {
2727
get: vi.fn(() =>
2828
Promise.resolve({
29-
workflowService: null,
30-
workflowModelName: null,
31-
workflowFile: null,
32-
workflow: null,
29+
agentFileService: null,
30+
agentFileModelName: null,
31+
agentFile: null,
32+
slug: null,
3333
}),
3434
),
3535
},
3636
}));
3737

3838
vi.mock("./services/types.js", () => ({
3939
SERVICE_NAMES: {
40-
WORKFLOW: "workflow",
40+
AGENT_FILE: "agentFile",
4141
},
4242
}));
4343

@@ -288,41 +288,41 @@ describe("ConfigEnhancer", () => {
288288
});
289289
});
290290

291-
it("should handle workflow integration gracefully when no workflow", async () => {
292-
// The mocked service container returns null workflow state
291+
it("should handle agent file integration gracefully when no agent file", async () => {
292+
// The mocked service container returns null agent file state
293293
const options: BaseCommandOptions = {
294294
rule: ["test-rule"],
295295
};
296296

297297
const config = await enhancer.enhanceConfig(mockConfig, options);
298298

299-
// Should work normally when no workflow is active
299+
// Should work normally when no agent file is active
300300
expect(config.rules).toEqual(["test-rule"]);
301301
});
302302

303-
it("should handle workflow integration when workflow is active", async () => {
304-
// Mock service container to return active workflow
303+
it("should handle agent file integration when agent file is active", async () => {
304+
// Mock service container to return active agent file
305305
const options: BaseCommandOptions = {
306306
rule: ["user-rule"],
307307
prompt: ["user-prompt"],
308308
};
309309

310310
const config = await enhancer.enhanceConfig(mockConfig, options, {
311-
workflowFile: {
312-
name: "Test Workflow",
311+
agentFile: {
312+
name: "Test Agent",
313313
prompt: "You are a test assistant",
314314
rules: "Always be helpful",
315315
model: "gpt-4",
316316
tools: "bash,read",
317317
},
318-
slug: "owner/test-workflow",
319-
workflowModelName: null,
320-
workflowService: null,
318+
slug: "owner/test-agent",
319+
agentFileModelName: null,
320+
agentFileService: null,
321321
});
322322

323-
// Should have both workflow and user rules
323+
// Should have both agent file and user rules
324324
expect(config.rules).toHaveLength(2);
325-
expect(config.rules?.[0]).toBe("Always be helpful"); // Workflow rule first
325+
expect(config.rules?.[0]).toBe("Always be helpful"); // Agent file rule first
326326
expect(config.rules?.[1]).toBe("user-rule"); // User rule second
327327
});
328328
});

extensions/cli/src/configEnhancer.ts

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {
22
AssistantUnrolled,
3-
parseWorkflowTools,
3+
parseAgentFileTools,
44
Rule,
55
} from "@continuedev/config-yaml";
66

@@ -12,24 +12,24 @@ import {
1212
modelProcessor,
1313
processRule,
1414
} from "./hubLoader.js";
15-
import { WorkflowServiceState } from "./services/types.js";
15+
import { AgentFileServiceState } from "./services/types.js";
1616
import { logger } from "./util/logger.js";
1717

1818
/**
1919
* Enhances a configuration by injecting additional components from CLI flags
2020
*/
2121
export class ConfigEnhancer {
2222
// added this for lint complexity rule
23-
private async enhanceConfigFromWorkflow(
23+
private async enhanceConfigFromAgentFile(
2424
config: AssistantUnrolled,
2525
_options: BaseCommandOptions | undefined,
26-
workflowState?: WorkflowServiceState,
26+
agentFileState?: AgentFileServiceState,
2727
) {
2828
const enhancedConfig = { ...config };
2929
const options = { ..._options };
3030

31-
if (workflowState?.workflowFile) {
32-
const { rules, model, tools, prompt } = workflowState?.workflowFile;
31+
if (agentFileState?.agentFile) {
32+
const { rules, model, tools, prompt } = agentFileState?.agentFile;
3333
if (rules) {
3434
options.rule = [
3535
...rules
@@ -42,38 +42,41 @@ export class ConfigEnhancer {
4242

4343
if (tools) {
4444
try {
45-
const parsedTools = parseWorkflowTools(tools);
45+
const parsedTools = parseAgentFileTools(tools);
4646
if (parsedTools.mcpServers.length > 0) {
4747
options.mcp = [...parsedTools.mcpServers, ...(options.mcp || [])];
4848
}
4949
} catch (e) {
50-
logger.error("Failed to parse workflow tools", e);
50+
logger.error("Failed to parse agent file tools", e);
5151
}
5252
}
5353

54-
// --model takes precedence over workflow model
54+
// --model takes precedence over agent file model
5555
if (model) {
5656
try {
57-
const workflowModel = await loadPackageFromHub(model, modelProcessor);
57+
const agentFileModel = await loadPackageFromHub(
58+
model,
59+
modelProcessor,
60+
);
5861
enhancedConfig.models = [
59-
workflowModel,
62+
agentFileModel,
6063
...(enhancedConfig.models ?? []),
6164
];
62-
workflowState?.workflowService?.setWorkflowModelName(
63-
workflowModel.name,
65+
agentFileState?.agentFileService?.setagentFileModelName(
66+
agentFileModel.name,
6467
);
6568
} catch (e) {
66-
logger.error("Failed to load workflow model", e);
69+
logger.error("Failed to load agent model", e);
6770
}
6871
}
6972

70-
// Workflow prompt is included as a slash command, initial kickoff is handled elsewhere
73+
// Agent file prompt is included as a slash command, initial kickoff is handled elsewhere
7174
if (prompt) {
7275
enhancedConfig.prompts = [
7376
{
74-
name: `Workflow prompt (${workflowState.workflowFile.name})`,
77+
name: `Agent prompt (${agentFileState.agentFile.name})`,
7578
prompt,
76-
description: workflowState.workflowFile.description,
79+
description: agentFileState.agentFile.description,
7780
},
7881
...(enhancedConfig.prompts ?? []),
7982
];
@@ -87,12 +90,12 @@ export class ConfigEnhancer {
8790
async enhanceConfig(
8891
config: AssistantUnrolled,
8992
_options?: BaseCommandOptions,
90-
workflowState?: WorkflowServiceState,
93+
agentFileState?: AgentFileServiceState,
9194
): Promise<AssistantUnrolled> {
92-
const enhanced = await this.enhanceConfigFromWorkflow(
95+
const enhanced = await this.enhanceConfigFromAgentFile(
9396
config,
9497
_options,
95-
workflowState,
98+
agentFileState,
9699
);
97100
let { enhancedConfig } = enhanced;
98101
const { options } = enhanced;

extensions/cli/src/hubLoader.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { parseWorkflowFile, WorkflowFile } from "@continuedev/config-yaml";
1+
import { AgentFile, parseAgentFile } from "@continuedev/config-yaml";
22
import JSZip from "jszip";
33

44
import { env } from "./env.js";
@@ -12,7 +12,7 @@ const HUB_SLUG_PATTERN = /^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/;
1212
/**
1313
* Hub package type definitions
1414
*/
15-
export type HubPackageType = "rule" | "mcp" | "model" | "prompt" | "workflow";
15+
export type HubPackageType = "rule" | "mcp" | "model" | "prompt" | "agentFile";
1616

1717
/**
1818
* Hub package processor interface
@@ -100,12 +100,12 @@ export const promptProcessor: HubPackageProcessor<string> = {
100100
parseContent: (content: string) => content,
101101
};
102102

103-
export const workflowProcessor: HubPackageProcessor<WorkflowFile> = {
104-
type: "workflow",
103+
export const agentFileProcessor: HubPackageProcessor<AgentFile> = {
104+
type: "agentFile",
105105
expectedFileExtensions: [".md"],
106-
parseContent: (content: string) => parseWorkflowFile(content),
107-
validateContent: (workflowFile: WorkflowFile) => {
108-
return !!workflowFile.name;
106+
parseContent: (content: string) => parseAgentFile(content),
107+
validateContent: (agentFile: AgentFile) => {
108+
return !!agentFile.name;
109109
},
110110
};
111111

extensions/cli/src/integration/rule-duplication.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ vi.mock("../hubLoader.js", () => ({
1919
modelProcessor: {},
2020
}));
2121

22-
// Mock the service container to provide empty workflow state
22+
// Mock the service container to provide empty agent file state
2323
vi.mock("../services/ServiceContainer.js", () => ({
2424
serviceContainer: {
2525
get: vi.fn(() =>
2626
Promise.resolve({
27-
workflowFile: null,
27+
agentFile: null,
2828
slug: null,
2929
}),
3030
),
@@ -33,7 +33,7 @@ vi.mock("../services/ServiceContainer.js", () => ({
3333

3434
vi.mock("../services/types.js", () => ({
3535
SERVICE_NAMES: {
36-
WORKFLOW: "workflow",
36+
AGENT_FILE: "agentFile",
3737
},
3838
}));
3939

0 commit comments

Comments
 (0)