@engineer-ai/plugin 1.8.0 → 1.8.1
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.
- package/dist/workflow.d.ts +76 -0
- package/dist/workflow.js +41 -0
- package/package.json +5 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow type definitions for the Engineer workflow system.
|
|
3
|
+
*
|
|
4
|
+
* Workflows are TypeScript files placed in `.engineer/workflows/*.ts` that
|
|
5
|
+
* orchestrate multi-step LLM interactions. Each workflow exports a default
|
|
6
|
+
* function (or a `defineWorkflow` result object) whose `run(ctx)` callback
|
|
7
|
+
* receives a {@link WorkflowContext}.
|
|
8
|
+
*
|
|
9
|
+
* Recommended usage (typed, requires `bun add @engineer-ai/plugin`):
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { defineWorkflow } from "@engineer-ai/plugin/workflow"
|
|
13
|
+
*
|
|
14
|
+
* export default defineWorkflow({
|
|
15
|
+
* name: "bug-fix",
|
|
16
|
+
* description: "Analyze, fix, and verify a bug",
|
|
17
|
+
* async run(ctx) {
|
|
18
|
+
* const analysis = await ctx.prompt("Analyze the bug in this code")
|
|
19
|
+
* await ctx.prompt("Fix the code based on:\n" + analysis)
|
|
20
|
+
* await ctx.prompt("Run the tests to verify the fix")
|
|
21
|
+
* },
|
|
22
|
+
* })
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* Minimal usage (zero dependencies):
|
|
26
|
+
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* export default async function (ctx) {
|
|
29
|
+
* await ctx.prompt("Review code quality")
|
|
30
|
+
* await ctx.prompt("Suggest improvements")
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
/** Options passed to {@link WorkflowContext.prompt}. */
|
|
35
|
+
export interface WorkflowPromptOptions {
|
|
36
|
+
/** Override the agent for this prompt (e.g. "agent", "plan"). */
|
|
37
|
+
agent?: string;
|
|
38
|
+
/** Model override in "providerID/modelID" form. */
|
|
39
|
+
model?: string;
|
|
40
|
+
/** Extra system prompt text appended for this step. */
|
|
41
|
+
system?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Runtime context injected into every workflow `run` callback.
|
|
45
|
+
* The implementation lives in the Engineer server (`WorkflowContextImpl`).
|
|
46
|
+
*/
|
|
47
|
+
export interface WorkflowContext {
|
|
48
|
+
/** The session this workflow executes within. */
|
|
49
|
+
sessionID: string;
|
|
50
|
+
/** Abort signal — fires when the user interrupts the session in the TUI. */
|
|
51
|
+
abort: AbortSignal;
|
|
52
|
+
/**
|
|
53
|
+
* Send a message to the session and block until the model replies.
|
|
54
|
+
* Returns the concatenated assistant text. Empty string means the
|
|
55
|
+
* model produced only tool calls with no text output.
|
|
56
|
+
*/
|
|
57
|
+
prompt(text: string, opts?: WorkflowPromptOptions): Promise<string>;
|
|
58
|
+
/** Launch arguments provided by the user (currently unused in the dialog flow). */
|
|
59
|
+
args?: string;
|
|
60
|
+
}
|
|
61
|
+
/** Metadata shown in the workflow list dialog. */
|
|
62
|
+
export interface WorkflowMeta {
|
|
63
|
+
name: string;
|
|
64
|
+
description: string;
|
|
65
|
+
}
|
|
66
|
+
/** Full workflow definition accepted by {@link defineWorkflow}. */
|
|
67
|
+
export interface WorkflowDef extends WorkflowMeta {
|
|
68
|
+
/** The workflow entry point. Each `ctx.prompt()` call blocks until the model replies. */
|
|
69
|
+
run(ctx: WorkflowContext): Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Identity function that provides type inference for {@link WorkflowDef}.
|
|
73
|
+
* Pass the object literal directly — it is returned unchanged at runtime,
|
|
74
|
+
* but the `run(ctx)` callback's `ctx` parameter is inferred as {@link WorkflowContext}.
|
|
75
|
+
*/
|
|
76
|
+
export declare function defineWorkflow(def: WorkflowDef): WorkflowDef;
|
package/dist/workflow.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow type definitions for the Engineer workflow system.
|
|
3
|
+
*
|
|
4
|
+
* Workflows are TypeScript files placed in `.engineer/workflows/*.ts` that
|
|
5
|
+
* orchestrate multi-step LLM interactions. Each workflow exports a default
|
|
6
|
+
* function (or a `defineWorkflow` result object) whose `run(ctx)` callback
|
|
7
|
+
* receives a {@link WorkflowContext}.
|
|
8
|
+
*
|
|
9
|
+
* Recommended usage (typed, requires `bun add @engineer-ai/plugin`):
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { defineWorkflow } from "@engineer-ai/plugin/workflow"
|
|
13
|
+
*
|
|
14
|
+
* export default defineWorkflow({
|
|
15
|
+
* name: "bug-fix",
|
|
16
|
+
* description: "Analyze, fix, and verify a bug",
|
|
17
|
+
* async run(ctx) {
|
|
18
|
+
* const analysis = await ctx.prompt("Analyze the bug in this code")
|
|
19
|
+
* await ctx.prompt("Fix the code based on:\n" + analysis)
|
|
20
|
+
* await ctx.prompt("Run the tests to verify the fix")
|
|
21
|
+
* },
|
|
22
|
+
* })
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* Minimal usage (zero dependencies):
|
|
26
|
+
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* export default async function (ctx) {
|
|
29
|
+
* await ctx.prompt("Review code quality")
|
|
30
|
+
* await ctx.prompt("Suggest improvements")
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* Identity function that provides type inference for {@link WorkflowDef}.
|
|
36
|
+
* Pass the object literal directly — it is returned unchanged at runtime,
|
|
37
|
+
* but the `run(ctx)` callback's `ctx` parameter is inferred as {@link WorkflowContext}.
|
|
38
|
+
*/
|
|
39
|
+
export function defineWorkflow(def) {
|
|
40
|
+
return def;
|
|
41
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@engineer-ai/plugin",
|
|
4
|
-
"version": "1.8.
|
|
4
|
+
"version": "1.8.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
"./tool": {
|
|
17
17
|
"import": "./dist/tool.js",
|
|
18
18
|
"types": "./dist/tool.d.ts"
|
|
19
|
+
},
|
|
20
|
+
"./workflow": {
|
|
21
|
+
"import": "./dist/workflow.js",
|
|
22
|
+
"types": "./dist/workflow.d.ts"
|
|
19
23
|
}
|
|
20
24
|
},
|
|
21
25
|
"files": [
|