@mokronos/wfkit 0.1.0 → 0.1.2

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/GUIDE.md ADDED
@@ -0,0 +1,123 @@
1
+ # Use wfkit with an agent
2
+
3
+ Use these instructions when a user asks you to set up or test `@mokronos/wfkit`. Work in the user's project directory and use a project-local installation so the setup is reproducible.
4
+
5
+ ## Communication contract
6
+
7
+ Before running a workflow, tell the user about every action they may need to take. This includes providing credentials, authorizing an account, approving a network request, or responding to a human-in-the-loop signal. Explain what is needed and why before the workflow reaches that point.
8
+
9
+ Never invent credentials, silently substitute a different service, or leave the user with a workflow that appears to hang. If `wf` prints a pending signal command, relay that command and the expected payload to the user verbatim.
10
+
11
+ The example below only reads a public file from GitHub. It does not need an account or token and does not change anything on GitHub. Before running it, tell the user that it will:
12
+
13
+ - send one outbound `GET` request to `raw.githubusercontent.com`;
14
+ - create local workflow state under `.wf/`;
15
+ - read a public repository without sending credentials.
16
+
17
+ If the environment blocks outbound network access, tell the user that network permission is required and wait for their direction.
18
+
19
+ ## Install and verify the CLI
20
+
21
+ Check that Bun 1.2 or newer is available, then install wfkit locally:
22
+
23
+ ```sh
24
+ bun --version
25
+ bun add --dev @mokronos/wfkit
26
+ bunx wf --help
27
+ ```
28
+
29
+ If Bun is unavailable, tell the user that wfkit currently requires Bun and ask before installing or changing their runtime setup.
30
+
31
+ ## Create a real integration workflow
32
+
33
+ Create `workflows/github-file-preview.ts` with this source:
34
+
35
+ ```ts
36
+ import { defineStep, defineWorkflow, t } from "@mokronos/wfkit"
37
+
38
+ const DownloadFailed = t.taggedStruct("DownloadFailed", {
39
+ url: t.string,
40
+ status: t.number
41
+ })
42
+
43
+ const fetchPublicGitHubFile = defineStep({
44
+ name: "FetchPublicGitHubFile",
45
+ input: t.struct({
46
+ owner: t.string,
47
+ repository: t.string,
48
+ path: t.string
49
+ }),
50
+ output: t.struct({
51
+ url: t.string,
52
+ bytes: t.number,
53
+ preview: t.string
54
+ }),
55
+ errors: DownloadFailed,
56
+ retry: { attempts: 3, backoff: "exponential" },
57
+ execute: async (input, step) => {
58
+ const encodedPath = input.path
59
+ .split("/")
60
+ .map((segment) => encodeURIComponent(segment))
61
+ .join("/")
62
+ const url = `https://raw.githubusercontent.com/${encodeURIComponent(input.owner)}/${encodeURIComponent(input.repository)}/HEAD/${encodedPath}`
63
+ const response = await fetch(url, {
64
+ headers: { "user-agent": "wfkit-agent-example" }
65
+ })
66
+
67
+ if (!response.ok) {
68
+ return step.fail({
69
+ _tag: "DownloadFailed",
70
+ url,
71
+ status: response.status
72
+ })
73
+ }
74
+
75
+ const contents = await response.text()
76
+ return {
77
+ url,
78
+ bytes: new TextEncoder().encode(contents).byteLength,
79
+ preview: contents.slice(0, 240)
80
+ }
81
+ }
82
+ })
83
+
84
+ export const GitHubFilePreviewWorkflow = defineWorkflow({
85
+ name: "GitHubFilePreviewWorkflow",
86
+ version: 1,
87
+ input: t.struct({
88
+ owner: t.string,
89
+ repository: t.string,
90
+ path: t.string
91
+ }),
92
+ output: t.struct({
93
+ url: t.string,
94
+ bytes: t.number,
95
+ preview: t.string
96
+ }),
97
+ errors: DownloadFailed,
98
+ run: function* (input, ctx) {
99
+ return yield* ctx.run(fetchPublicGitHubFile, input)
100
+ }
101
+ })
102
+ ```
103
+
104
+ Register and run it:
105
+
106
+ ```sh
107
+ bunx wf create github-file-preview --file workflows/github-file-preview.ts --version 1
108
+ bunx wf list
109
+ bunx wf run github-file-preview '{"owner":"Effect-TS","repository":"effect","path":"README.md"}'
110
+ bunx wf runs
111
+ ```
112
+
113
+ Report the returned URL, byte count, and preview to the user. The completed run and its event history are persisted in `.wf/`; use the run ID printed by `wf run` to inspect it:
114
+
115
+ ```sh
116
+ bunx wf history <run-id>
117
+ ```
118
+
119
+ ## Continue from here
120
+
121
+ When adapting this example to an authenticated API, do not place secret values in workflow inputs or source code. Tell the user which secret is required, arrange an approved secret source, and use wfkit secret references so durable history stores the reference rather than the value.
122
+
123
+ For human approval flows, explain the decision and payload to the user before starting. When the run suspends, copy the exact `wf signal ...` command printed by the CLI and wait for the user's response before sending it.
package/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ > **[Use with your agent →](https://github.com/mokronos/wf/blob/main/packages/wf/GUIDE.md)** Copy the guide into your chat so your agent can install wfkit and run a real workflow for you.
2
+
1
3
  # @mokronos/wfkit
2
4
 
3
5
  @mokronos/wfkit is the Bun-first SDK for authoring and running durable workflows in plain TypeScript. Workflows have typed inputs, outputs, and errors; the engine (built on `@effect/workflow`) persists every step result, timer, and signal wait in SQLite, so executions replay deterministically and survive process restarts.
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/sdk/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,YAAY,CAAA;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAA;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAA;CACnC;AAED,eAAO,MAAM,iBAAiB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,eAK3D,CAAA;AA6CD,eAAO,MAAM,oBAAoB,GAC/B,UAAU,gBAAgB,KACzB,OAAO,CAAC,cAAc,CAqCxB,CAAA"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/sdk/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,YAAY,CAAA;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAA;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAA;CACnC;AAED,eAAO,MAAM,iBAAiB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,eAK3D,CAAA;AA8CD,eAAO,MAAM,oBAAoB,GAC/B,UAAU,gBAAgB,KACzB,OAAO,CAAC,cAAc,CAqCxB,CAAA"}
@@ -37,7 +37,8 @@ const compileWorkflowSource = async (artifact) => {
37
37
  }).outputText}\n//# sourceURL=wf:${artifact.id}@${artifact.version}\n`;
38
38
  };
39
39
  const rewriteWfImports = (source) => {
40
- const wfModuleUrl = new URL("../authoring.ts", import.meta.url).href;
40
+ const authoringModule = import.meta.url.endsWith(".ts") ? "../authoring.ts" : "../authoring.js";
41
+ const wfModuleUrl = new URL(authoringModule, import.meta.url).href;
41
42
  return source
42
43
  .replaceAll(`from "@mokronos/wfkit"`, `from "${wfModuleUrl}"`)
43
44
  .replaceAll(`from '@mokronos/wfkit'`, `from '${wfModuleUrl}'`)
@@ -1 +1 @@
1
- {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/sdk/loader.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EAAE,qBAAqB,EAAwB,MAAM,YAAY,CAAA;AASxE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAc,EAA4B,EAAE;IAC5E,IAAI,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,UAAU,CAAC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACjF,OAAO,KAAK,CAAA;IACd,CAAC;IACD,OAAO,qBAAqB,IAAI,KAAK,CAAA;AACvC,CAAC,CAAA;AAOD,MAAM,oBAAoB,GAAG,KAAK,EAChC,QAA0B,EACD,EAAE;IAC3B,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC,QAAQ,CAAC,CAAA;IACtD,MAAM,GAAG,GAAG,+BAA+B,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,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,CAAC,CAAE,CAAA;QAC7C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAA;IAC3C,CAAC;IAED,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACzD,MAAM,IAAI,KAAK,CACb,YAAY,QAAQ,CAAC,EAAE,gCAAgC,KAAK,mCAAmC,CAChG,CAAA;IACH,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,YAAY,QAAQ,CAAC,EAAE,+BAA+B,CAAC,CAAA;AACzE,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mokronos/wfkit",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "The workflow authoring surface — the stable API agents design against.",
6
6
  "license": "MIT",
@@ -28,7 +28,8 @@
28
28
  "files": [
29
29
  "src",
30
30
  "dist",
31
- "README.md"
31
+ "README.md",
32
+ "GUIDE.md"
32
33
  ],
33
34
  "bin": {
34
35
  "wf": "dist/cli/main.js",
@@ -59,9 +60,10 @@
59
60
  "prepublishOnly": "bun run build"
60
61
  },
61
62
  "dependencies": {
62
- "@effect/platform-bun": "^4.0.0-beta.93",
63
- "@effect/platform-node": "^4.0.0-beta.93",
64
- "@effect/sql-sqlite-bun": "^4.0.0-beta.93",
65
- "effect": "^4.0.0-beta.93"
63
+ "@effect/platform-bun": "4.0.0-beta.93",
64
+ "@effect/platform-node": "4.0.0-beta.93",
65
+ "@effect/platform-node-shared": "4.0.0-beta.93",
66
+ "@effect/sql-sqlite-bun": "4.0.0-beta.93",
67
+ "effect": "4.0.0-beta.93"
66
68
  }
67
69
  }
package/src/sdk/loader.ts CHANGED
@@ -49,7 +49,8 @@ const compileWorkflowSource = async (artifact: WorkflowArtifact): Promise<string
49
49
  }
50
50
 
51
51
  const rewriteWfImports = (source: string): string => {
52
- const wfModuleUrl = new URL("../authoring.ts", import.meta.url).href
52
+ const authoringModule = import.meta.url.endsWith(".ts") ? "../authoring.ts" : "../authoring.js"
53
+ const wfModuleUrl = new URL(authoringModule, import.meta.url).href
53
54
  return source
54
55
  .replaceAll(`from "@mokronos/wfkit"`, `from "${wfModuleUrl}"`)
55
56
  .replaceAll(`from '@mokronos/wfkit'`, `from '${wfModuleUrl}'`)