omkit 0.4.8 → 0.8.0

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.
Files changed (89) hide show
  1. package/CHANGELOG.md +153 -0
  2. package/README.md +168 -12
  3. package/dist/actions/chrome-page.d.ts +41 -0
  4. package/dist/actions/chrome-page.js +77 -29
  5. package/dist/actions/drive-page.d.ts +50 -0
  6. package/dist/actions/drive-page.js +68 -0
  7. package/dist/actions/index.d.ts +5 -3
  8. package/dist/actions/index.js +2 -1
  9. package/dist/actions/prompt.d.ts +32 -5
  10. package/dist/actions/prompt.js +92 -8
  11. package/dist/cli/commands/help.js +6 -0
  12. package/dist/cli/commands/init.js +1 -1
  13. package/dist/cli/commands/ls.d.ts +11 -4
  14. package/dist/cli/commands/ls.js +35 -15
  15. package/dist/cli/commands/mcp.d.ts +10 -0
  16. package/dist/cli/commands/mcp.js +13 -0
  17. package/dist/cli/commands/skill.d.ts +17 -0
  18. package/dist/cli/commands/skill.js +56 -0
  19. package/dist/cli/index.d.ts +8 -0
  20. package/dist/cli/index.js +71 -29
  21. package/dist/client/discover-child.d.ts +12 -0
  22. package/dist/client/discover-child.js +71 -0
  23. package/dist/client/discovery.d.ts +21 -1
  24. package/dist/client/discovery.js +139 -2
  25. package/dist/client/index.d.ts +2 -1
  26. package/dist/client/index.js +3 -1
  27. package/dist/client/outline.d.ts +35 -0
  28. package/dist/client/outline.js +100 -0
  29. package/dist/client/registry.d.ts +59 -0
  30. package/dist/client/runner.d.ts +12 -0
  31. package/dist/client/runner.js +16 -7
  32. package/dist/client/types.d.ts +9 -1
  33. package/dist/core/ActionRun.d.ts +5 -0
  34. package/dist/core/ActionRun.js +9 -0
  35. package/dist/core/ExecutionTree.d.ts +40 -2
  36. package/dist/core/ExecutionTree.js +66 -2
  37. package/dist/core/action.d.ts +2 -1
  38. package/dist/core/action.js +93 -9
  39. package/dist/core/args.d.ts +50 -0
  40. package/dist/core/args.js +166 -0
  41. package/dist/core/discovery-mode.d.ts +37 -0
  42. package/dist/core/discovery-mode.js +54 -0
  43. package/dist/core/interaction.d.ts +3 -1
  44. package/dist/core/om.d.ts +11 -9
  45. package/dist/core/om.js +182 -13
  46. package/dist/core/schema-hint.d.ts +20 -0
  47. package/dist/core/schema-hint.js +73 -0
  48. package/dist/core/schema-json.d.ts +12 -0
  49. package/dist/core/schema-json.js +12 -0
  50. package/dist/core/types.d.ts +113 -1
  51. package/dist/foundation/LogEntry.d.ts +1 -1
  52. package/dist/foundation/canonicalPath.d.ts +26 -0
  53. package/dist/foundation/canonicalPath.js +34 -0
  54. package/dist/index.d.ts +2 -2
  55. package/dist/index.js +1 -1
  56. package/dist/mcp/action-host.d.ts +1 -0
  57. package/dist/mcp/action-host.js +65 -0
  58. package/dist/mcp/action-identity.d.ts +23 -0
  59. package/dist/mcp/action-identity.js +35 -0
  60. package/dist/mcp/progress.d.ts +61 -0
  61. package/dist/mcp/progress.js +92 -0
  62. package/dist/mcp/resources.d.ts +55 -0
  63. package/dist/mcp/resources.js +208 -0
  64. package/dist/mcp/runs.d.ts +37 -0
  65. package/dist/mcp/runs.js +60 -0
  66. package/dist/mcp/server.d.ts +19 -0
  67. package/dist/mcp/server.js +38 -0
  68. package/dist/mcp/tail.d.ts +37 -0
  69. package/dist/mcp/tail.js +64 -0
  70. package/dist/mcp/tools.d.ts +54 -0
  71. package/dist/mcp/tools.js +374 -0
  72. package/dist/mcp/validate.d.ts +14 -0
  73. package/dist/mcp/validate.js +54 -0
  74. package/dist/mcp/verdict.d.ts +31 -0
  75. package/dist/mcp/verdict.js +47 -0
  76. package/dist/output/artifact/ArtifactStore.d.ts +24 -0
  77. package/dist/output/artifact/ArtifactStore.js +49 -0
  78. package/dist/output/folder/RunFolder.d.ts +23 -1
  79. package/dist/output/folder/RunFolder.js +55 -11
  80. package/dist/output/writers/views.d.ts +10 -0
  81. package/dist/skill/file.d.ts +26 -0
  82. package/dist/skill/file.js +58 -0
  83. package/dist/skill/index.d.ts +11 -0
  84. package/dist/skill/index.js +9 -0
  85. package/dist/skill/model.d.ts +55 -0
  86. package/dist/skill/model.js +116 -0
  87. package/dist/skill/render.d.ts +18 -0
  88. package/dist/skill/render.js +133 -0
  89. package/package.json +5 -2
@@ -0,0 +1,133 @@
1
+ /** The skill's directory name, and so the `name:` in its frontmatter. */
2
+ export const SKILL_NAME = "omkit-runs";
3
+ /**
4
+ * The marker line that carries the staleness hash. Written by {@link renderSkill} and read
5
+ * back by the file layer, so the two agree on one format rather than two regexes.
6
+ */
7
+ export const generatedBy = (hash) => `<!-- GENERATED by \`omkit skill\`. Do not edit. registry-hash: ${hash} -->`;
8
+ /**
9
+ * Render the model as the skill's markdown.
10
+ *
11
+ * Deterministic by construction: no timestamps, no absolute paths, no iteration over unordered
12
+ * collections — the model arrives sorted. A generated file that is committed and churns on
13
+ * every run is a file people stop reading.
14
+ */
15
+ export function renderSkill(model, opts) {
16
+ const lines = [
17
+ "---",
18
+ `name: ${SKILL_NAME}`,
19
+ `description: ${opts.description}`,
20
+ "---",
21
+ "",
22
+ "# omkit — runnable workflows",
23
+ "",
24
+ generatedBy(model.hash),
25
+ "",
26
+ ...howToRun(model),
27
+ ...workflows(model),
28
+ ...actions(model),
29
+ ...whereOutputLands(),
30
+ ];
31
+ return `${lines.join("\n")}\n`;
32
+ }
33
+ function howToRun(model) {
34
+ const example = model.oms[0]?.name ?? "<om>";
35
+ const withArgs = model.oms.find((o) => o.argHint !== undefined) ?? model.oms[0];
36
+ return [
37
+ "## How to run",
38
+ "",
39
+ "**Shell — always available:**",
40
+ "",
41
+ "```bash",
42
+ `npx omkit run ${example}`,
43
+ `OMKIT_ARGS='${exampleArgs(withArgs)}' npx omkit run ${withArgs?.name ?? example}`,
44
+ "```",
45
+ "",
46
+ "Arguments travel as one JSON object in `OMKIT_ARGS`. Anything an om declares but does not",
47
+ "receive is filled from the schema's defaults, and only then by asking.",
48
+ "",
49
+ '**MCP — if configured:** `run_om("<name>", { …args })` runs a settling workflow to',
50
+ "completion and returns its verdict; `start_om` starts a long-lived one and returns a run id",
51
+ "to poll with `get_run`, read with `tail_run`, and end with `cancel_run`.",
52
+ "",
53
+ "To wire it up: `claude mcp add omkit -- npx omkit mcp`",
54
+ "",
55
+ "At runtime `list_oms` is authoritative — this file is orientation, and can drift.",
56
+ "",
57
+ ];
58
+ }
59
+ /**
60
+ * A plausible `OMKIT_ARGS` value built from the first declared field, so the example shows the
61
+ * real shape rather than a placeholder. Falls back to an empty object when nothing is declared.
62
+ */
63
+ function exampleArgs(entry) {
64
+ const match = entry?.argHint?.match(/\{ (\w+)\??: (\w+)/);
65
+ if (!match)
66
+ return "{}";
67
+ const [, field, type] = match;
68
+ const value = type === "string" ? '"…"' : type === "boolean" ? "false" : "0";
69
+ return `{"${field}":${value}}`;
70
+ }
71
+ function workflows(model) {
72
+ if (model.oms.length === 0) {
73
+ return ["## Workflows", "", "_None exposed. Mark an om with `.mcp()` to list it here._", ""];
74
+ }
75
+ return ["## Workflows", "", ...model.oms.flatMap((om) => entry(om, omHeading(om)))];
76
+ }
77
+ function actions(model) {
78
+ if (model.actions.length === 0)
79
+ return [];
80
+ return [
81
+ "## Actions",
82
+ "",
83
+ "An action is a step, not a run. It cannot execute on its own — omkit hosts it in a",
84
+ "generated om so it has a run to belong to, which means it gets its own run folder and",
85
+ "verdict like anything else.",
86
+ "",
87
+ ...model.actions.flatMap((a) => entry(a, `### \`${a.name}\``)),
88
+ ];
89
+ }
90
+ function omHeading(om) {
91
+ const mode = om.mode === "long-lived" ? "long-lived · `start_om` only, it does not finish" : "settling";
92
+ return `### \`${om.name}\` — ${mode}`;
93
+ }
94
+ function entry(e, heading) {
95
+ const lines = [heading, ""];
96
+ lines.push(e.summary ?? "_No summary. The author can add one with `.describe({ summary })`._", "");
97
+ lines.push(`- **Defined in:** \`${e.file}\``);
98
+ if (e.kind === "action" && e.exportName)
99
+ lines.push(`- **Exported as:** \`${e.exportName}\``);
100
+ if (e.argHint)
101
+ lines.push(`- **Args:** \`${e.argHint}\``);
102
+ if (e.calls?.length)
103
+ lines.push(`- **Calls:** ${e.calls.map(renderCall).join(" → ")}`);
104
+ if (e.publishesCapability) {
105
+ lines.push("- **Publishes a capability.** It hands a live handle to whatever runs after it. Run on", " its own there is no downstream, so the handle goes nowhere — useful for a smoke test,", " not for the thing the capability was for.");
106
+ }
107
+ if (e.unavailable)
108
+ lines.push(`- **Not callable:** ${e.unavailable}`);
109
+ if (e.argSchema) {
110
+ lines.push("- **Args** (no short form — the schema is the contract):", "", "```json");
111
+ lines.push(JSON.stringify(e.argSchema, null, 2));
112
+ lines.push("```");
113
+ }
114
+ lines.push("");
115
+ return lines;
116
+ }
117
+ const renderCall = (c) => c.tag ? `\`${c.name}\` [${c.tag}]` : `\`${c.name}\``;
118
+ function whereOutputLands() {
119
+ return [
120
+ "## Where output lands",
121
+ "",
122
+ "`logs/<name>-<hash8>/<date>/<time>/` — `main.log`, `result.json`, `artifacts.log`,",
123
+ "`events.log`, `asserts.log`, `raw.jsonl`. A run's identity is its name plus its defining",
124
+ 'file, so "the latest run of X" is always resolvable without parsing scrollback.',
125
+ "",
126
+ "## What the outlines above do and do not tell you",
127
+ "",
128
+ "**Calls** is a static reading of the body, not a trace. A conditional call is listed",
129
+ "unconditionally, a loop is listed once, an action chosen at runtime is not listed at all,",
130
+ 'and a call made inside a helper function is invisible to it. Read it as "roughly what',
131
+ 'happens in here" and read `result.json` for what actually did.',
132
+ ];
133
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omkit",
3
- "version": "0.4.8",
3
+ "version": "0.8.0",
4
4
  "description": "A tiny runtime for developer workflows: typed actions that pass runtime capabilities and emit typed events, under one run and one shared log. The operational/runtime layer to tskb's knowledge layer.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -10,7 +10,8 @@
10
10
  },
11
11
  "files": [
12
12
  "dist",
13
- "LICENSE"
13
+ "LICENSE",
14
+ "CHANGELOG.md"
14
15
  ],
15
16
  "exports": {
16
17
  ".": {
@@ -52,11 +53,13 @@
52
53
  "developer-tools"
53
54
  ],
54
55
  "dependencies": {
56
+ "@modelcontextprotocol/sdk": "^1.30.0",
55
57
  "ink": "^7.1.1",
56
58
  "patch-console": "^2.0.0",
57
59
  "playwright-core": "^1.49.0",
58
60
  "react": "^19.2.8",
59
61
  "tsx": "4.23.1",
62
+ "zod": "^4.4.3",
60
63
  "zx": "^8.8.5"
61
64
  },
62
65
  "devDependencies": {