@bastani/atomic 0.8.23 → 0.8.24-alpha.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/CHANGELOG.md +15 -0
- package/dist/builtin/intercom/CHANGELOG.md +7 -0
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/CHANGELOG.md +7 -0
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +22 -0
- package/dist/builtin/subagents/README.md +16 -0
- package/dist/builtin/subagents/agents/code-simplifier.md +2 -3
- package/dist/builtin/subagents/agents/codebase-analyzer.md +2 -3
- package/dist/builtin/subagents/agents/codebase-locator.md +2 -3
- package/dist/builtin/subagents/agents/codebase-online-researcher.md +2 -3
- package/dist/builtin/subagents/agents/codebase-pattern-finder.md +2 -3
- package/dist/builtin/subagents/agents/codebase-research-analyzer.md +2 -3
- package/dist/builtin/subagents/agents/codebase-research-locator.md +2 -3
- package/dist/builtin/subagents/agents/debugger.md +2 -3
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/skills/subagent/SKILL.md +6 -0
- package/dist/builtin/subagents/src/agents/agent-serializer.ts +3 -0
- package/dist/builtin/subagents/src/agents/agents.ts +20 -1
- package/dist/builtin/subagents/src/runs/background/async-execution.ts +1 -1
- package/dist/builtin/subagents/src/runs/background/subagent-runner.ts +3 -1
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify.ts +7 -7
- package/dist/builtin/subagents/src/runs/foreground/execution.ts +5 -1
- package/dist/builtin/subagents/src/runs/shared/model-fallback.ts +9 -10
- package/dist/builtin/subagents/src/shared/types.ts +1 -0
- package/dist/builtin/web-access/CHANGELOG.md +7 -0
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +25 -0
- package/dist/builtin/workflows/README.md +38 -41
- package/dist/builtin/workflows/builtin/deep-research-codebase.d.ts +35 -0
- package/dist/builtin/workflows/builtin/deep-research-codebase.ts +11 -14
- package/dist/builtin/workflows/builtin/goal.d.ts +46 -0
- package/dist/builtin/workflows/builtin/goal.ts +10 -12
- package/dist/builtin/workflows/builtin/index.d.ts +136 -0
- package/dist/builtin/workflows/builtin/open-claude-design.d.ts +44 -0
- package/dist/builtin/workflows/builtin/open-claude-design.ts +19 -20
- package/dist/builtin/workflows/builtin/ralph.d.ts +36 -0
- package/dist/builtin/workflows/builtin/ralph.ts +20 -24
- package/dist/builtin/workflows/package.json +15 -5
- package/dist/builtin/workflows/src/authoring.ts +410 -0
- package/dist/builtin/workflows/src/extension/workflow-module-loader.ts +6 -12
- package/dist/builtin/workflows/src/extension/workflow-schema.ts +3 -2
- package/dist/builtin/workflows/src/index.ts +0 -5
- package/dist/builtin/workflows/src/runs/foreground/executor.ts +23 -9
- package/dist/builtin/workflows/src/runs/foreground/stage-runner.ts +33 -5
- package/dist/builtin/workflows/src/runs/shared/model-fallback.ts +61 -10
- package/dist/builtin/workflows/src/sdk-surface.ts +12 -2
- package/dist/builtin/workflows/src/shared/authoring-contract.ts +660 -0
- package/dist/builtin/workflows/src/shared/render-inputs-schema.ts +1 -1
- package/dist/builtin/workflows/src/shared/types.ts +65 -350
- package/dist/builtin/workflows/src/workflows/define-workflow.ts +59 -44
- package/dist/core/atomic-guide-command.d.ts.map +1 -1
- package/dist/core/atomic-guide-command.js +1 -1
- package/dist/core/atomic-guide-command.js.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.d.ts +1 -0
- package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.js +13 -1
- package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +1 -1
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +23 -16
- package/dist/utils/changelog.js.map +1 -1
- package/docs/extensions.md +2 -2
- package/docs/packages.md +8 -4
- package/docs/subagents.md +30 -0
- package/docs/workflows.md +39 -21
- package/package.json +1 -1
- package/dist/builtin/workflows/src/runs/shared/workflow-runner.ts +0 -335
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../../src/utils/changelog.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,cAAe,SAAQ,YAAY;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CAChB;
|
|
1
|
+
{"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../../src/utils/changelog.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,cAAe,SAAQ,YAAY;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CAChB;AA8CD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,aAAa,EAAE,MAAM,GAAG,cAAc,EAAE,CA+CtE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,YAAY,GAAG,MAAM,CAQ1E;AAmBD,wBAAgB,aAAa,CAC5B,OAAO,EAAE,cAAc,EAAE,EACzB,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,MAAM,GACrB,cAAc,EAAE,CAgBlB;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,EAAE,CAIjG;AAGD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC","sourcesContent":["import { existsSync, readFileSync } from \"fs\";\n\nexport interface VersionParts {\n\tmajor: number;\n\tminor: number;\n\tpatch: number;\n\tprerelease: number | null;\n}\n\nexport interface ChangelogEntry extends VersionParts {\n\tversion: string;\n\tcontent: string;\n}\n\n// The prerelease group accepts BOTH the legacy numeric form (`-N`) and the new\n// `-alpha.N` convention while capturing the numeric revision. The outer capture\n// group preserves the raw version substring so each entry's `version` round-trips\n// faithfully (a `0.8.1-0` header stays `0.8.1-0`; a `0.8.2-alpha.1` header stays\n// `0.8.2-alpha.1`).\nconst RELEASE_VERSION_RE = /^(?:v)?((0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-(?:alpha\\.)?(0|[1-9]\\d*))?)$/;\nconst CHANGELOG_VERSION_HEADER_RE =\n\t/^##\\s+\\[?((0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-(?:alpha\\.)?(0|[1-9]\\d*))?)\\]?/;\n\ninterface ParsedVersion extends VersionParts {\n\tversion: string;\n}\n\nfunction parsedVersionFromMatch(match: RegExpMatchArray): ParsedVersion {\n\treturn {\n\t\tversion: match[1] as string,\n\t\tmajor: Number.parseInt(match[2] as string, 10),\n\t\tminor: Number.parseInt(match[3] as string, 10),\n\t\tpatch: Number.parseInt(match[4] as string, 10),\n\t\tprerelease: match[5] === undefined ? null : Number.parseInt(match[5], 10),\n\t};\n}\n\nfunction parseVersion(version: string): VersionParts | null {\n\tconst match = version.trim().match(RELEASE_VERSION_RE);\n\treturn match ? parsedVersionFromMatch(match) : null;\n}\n\nfunction parseVersionHeader(line: string): ParsedVersion | null {\n\tconst match = line.match(CHANGELOG_VERSION_HEADER_RE);\n\treturn match ? parsedVersionFromMatch(match) : null;\n}\n\nfunction createChangelogEntry(version: ParsedVersion, lines: string[]): ChangelogEntry {\n\treturn {\n\t\tmajor: version.major,\n\t\tminor: version.minor,\n\t\tpatch: version.patch,\n\t\tprerelease: version.prerelease,\n\t\tversion: version.version,\n\t\tcontent: lines.join(\"\\n\").trim(),\n\t};\n}\n\n/**\n * Parse changelog entries from CHANGELOG.md\n * Scans for ## lines and collects content until next ## or EOF\n */\nexport function parseChangelog(changelogPath: string): ChangelogEntry[] {\n\tif (!existsSync(changelogPath)) {\n\t\treturn [];\n\t}\n\n\ttry {\n\t\tconst content = readFileSync(changelogPath, \"utf-8\");\n\t\tconst lines = content.split(\"\\n\");\n\t\tconst entries: ChangelogEntry[] = [];\n\n\t\tlet currentLines: string[] = [];\n\t\tlet currentVersion: ParsedVersion | null = null;\n\n\t\tfor (const line of lines) {\n\t\t\t// Check if this is a version header (## [x.y.z] ...)\n\t\t\tif (line.startsWith(\"## \")) {\n\t\t\t\t// Save previous entry if exists\n\t\t\t\tif (currentVersion && currentLines.length > 0) {\n\t\t\t\t\tentries.push(createChangelogEntry(currentVersion, currentLines));\n\t\t\t\t}\n\n\t\t\t\t// Try to parse version from this line\n\t\t\t\tconst versionParts = parseVersionHeader(line);\n\t\t\t\tif (versionParts) {\n\t\t\t\t\tcurrentVersion = versionParts;\n\t\t\t\t\tcurrentLines = [line];\n\t\t\t\t} else {\n\t\t\t\t\t// Reset if we can't parse version\n\t\t\t\t\tcurrentVersion = null;\n\t\t\t\t\tcurrentLines = [];\n\t\t\t\t}\n\t\t\t} else if (currentVersion) {\n\t\t\t\t// Collect lines for current version\n\t\t\t\tcurrentLines.push(line);\n\t\t\t}\n\t\t}\n\n\t\t// Save last entry\n\t\tif (currentVersion && currentLines.length > 0) {\n\t\t\tentries.push(createChangelogEntry(currentVersion, currentLines));\n\t\t}\n\n\t\treturn entries;\n\t} catch (error) {\n\t\tconsole.error(`Warning: Could not parse changelog: ${error}`);\n\t\treturn [];\n\t}\n}\n\n/**\n * Compare versions. Returns: -1 if v1 < v2, 0 if v1 === v2, 1 if v1 > v2\n */\nexport function compareVersions(v1: VersionParts, v2: VersionParts): number {\n\tif (v1.major !== v2.major) return v1.major - v2.major;\n\tif (v1.minor !== v2.minor) return v1.minor - v2.minor;\n\tif (v1.patch !== v2.patch) return v1.patch - v2.patch;\n\tif (v1.prerelease === v2.prerelease) return 0;\n\tif (v1.prerelease === null) return 1;\n\tif (v2.prerelease === null) return -1;\n\treturn v1.prerelease - v2.prerelease;\n}\n\n/**\n * Get entries newer than lastVersion, optionally bounded by currentVersion.\n *\n * Atomic uses alpha prereleases (for example, 0.8.2-alpha.1, with the revision\n * starting at 1) while legacy numeric prerelease entries (for example, 0.8.1-0)\n * remain parseable, and started its own\n * version line above the upstream Pi changelog history. When currentVersion is\n * provided, changelog order wins over semantic version filtering so historical\n * upstream entries like 0.74.0 or an old 0.10.0 section are not treated as\n * newer Atomic releases.\n */\nfunction findVersionIndex(entries: ChangelogEntry[], version: string): number {\n\tconst target = parseVersion(version);\n\tif (!target) return -1;\n\treturn entries.findIndex((entry) => compareVersions(entry, target) === 0);\n}\n\nexport function getNewEntries(\n\tentries: ChangelogEntry[],\n\tlastVersion: string,\n\tcurrentVersion?: string,\n): ChangelogEntry[] {\n\tif (currentVersion) {\n\t\tconst currentIndex = findVersionIndex(entries, currentVersion);\n\t\tif (currentIndex === -1) return [];\n\n\t\tconst lastIndex = findVersionIndex(entries, lastVersion);\n\t\tif (lastIndex !== -1) {\n\t\t\treturn currentIndex < lastIndex ? entries.slice(currentIndex, lastIndex) : [];\n\t\t}\n\n\t\tconst currentEntry = entries[currentIndex];\n\t\treturn currentIndex === 0 && currentEntry ? [currentEntry] : [];\n\t}\n\n\tconst last = parseVersion(lastVersion) ?? { major: 0, minor: 0, patch: 0, prerelease: null };\n\treturn entries.filter((entry) => compareVersions(entry, last) > 0);\n}\n\nexport function getEntriesForVersion(entries: ChangelogEntry[], version: string): ChangelogEntry[] {\n\tconst target = parseVersion(version);\n\tif (!target) return [];\n\treturn entries.filter((entry) => compareVersions(entry, target) === 0);\n}\n\n// Re-export getChangelogPath from paths.ts for convenience\nexport { getChangelogPath } from \"../config.ts\";\n"]}
|
package/dist/utils/changelog.js
CHANGED
|
@@ -1,30 +1,35 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "fs";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
// The prerelease group accepts BOTH the legacy numeric form (`-N`) and the new
|
|
3
|
+
// `-alpha.N` convention while capturing the numeric revision. The outer capture
|
|
4
|
+
// group preserves the raw version substring so each entry's `version` round-trips
|
|
5
|
+
// faithfully (a `0.8.1-0` header stays `0.8.1-0`; a `0.8.2-alpha.1` header stays
|
|
6
|
+
// `0.8.2-alpha.1`).
|
|
7
|
+
const RELEASE_VERSION_RE = /^(?:v)?((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-(?:alpha\.)?(0|[1-9]\d*))?)$/;
|
|
8
|
+
const CHANGELOG_VERSION_HEADER_RE = /^##\s+\[?((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-(?:alpha\.)?(0|[1-9]\d*))?)\]?/;
|
|
9
|
+
function parsedVersionFromMatch(match) {
|
|
9
10
|
return {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
version: match[1],
|
|
12
|
+
major: Number.parseInt(match[2], 10),
|
|
13
|
+
minor: Number.parseInt(match[3], 10),
|
|
14
|
+
patch: Number.parseInt(match[4], 10),
|
|
15
|
+
prerelease: match[5] === undefined ? null : Number.parseInt(match[5], 10),
|
|
14
16
|
};
|
|
15
17
|
}
|
|
16
18
|
function parseVersion(version) {
|
|
17
19
|
const match = version.trim().match(RELEASE_VERSION_RE);
|
|
18
|
-
return match ?
|
|
20
|
+
return match ? parsedVersionFromMatch(match) : null;
|
|
19
21
|
}
|
|
20
22
|
function parseVersionHeader(line) {
|
|
21
23
|
const match = line.match(CHANGELOG_VERSION_HEADER_RE);
|
|
22
|
-
return match ?
|
|
24
|
+
return match ? parsedVersionFromMatch(match) : null;
|
|
23
25
|
}
|
|
24
26
|
function createChangelogEntry(version, lines) {
|
|
25
27
|
return {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
major: version.major,
|
|
29
|
+
minor: version.minor,
|
|
30
|
+
patch: version.patch,
|
|
31
|
+
prerelease: version.prerelease,
|
|
32
|
+
version: version.version,
|
|
28
33
|
content: lines.join("\n").trim(),
|
|
29
34
|
};
|
|
30
35
|
}
|
|
@@ -98,7 +103,9 @@ export function compareVersions(v1, v2) {
|
|
|
98
103
|
/**
|
|
99
104
|
* Get entries newer than lastVersion, optionally bounded by currentVersion.
|
|
100
105
|
*
|
|
101
|
-
* Atomic uses
|
|
106
|
+
* Atomic uses alpha prereleases (for example, 0.8.2-alpha.1, with the revision
|
|
107
|
+
* starting at 1) while legacy numeric prerelease entries (for example, 0.8.1-0)
|
|
108
|
+
* remain parseable, and started its own
|
|
102
109
|
* version line above the upstream Pi changelog history. When currentVersion is
|
|
103
110
|
* provided, changelog order wins over semantic version filtering so historical
|
|
104
111
|
* upstream entries like 0.74.0 or an old 0.10.0 section are not treated as
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changelog.js","sourceRoot":"","sources":["../../src/utils/changelog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAc9C,MAAM,kBAAkB,GAAG,oEAAoE,CAAC;AAChG,MAAM,2BAA2B,GAAG,wEAAwE,CAAC;AAE7G,SAAS,aAAa,CAAC,KAAmB;IACzC,MAAM,IAAI,GAAG,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;IAC5D,OAAO,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,KAAK,CA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gB,EAAE,MAAM,cAAc,CAAC","sourcesContent":["import { existsSync, readFileSync } from \"fs\";\n\nexport interface VersionParts {\n\tmajor: number;\n\tminor: number;\n\tpatch: number;\n\tprerelease: number | null;\n}\n\nexport interface ChangelogEntry extends VersionParts {\n\tversion: string;\n\tcontent: string;\n}\n\nconst RELEASE_VERSION_RE = /^(?:v)?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-(0|[1-9]\\d*))?$/;\nconst CHANGELOG_VERSION_HEADER_RE = /^##\\s+\\[?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-(0|[1-9]\\d*))?\\]?/;\n\nfunction formatVersion(parts: VersionParts): string {\n\tconst base = `${parts.major}.${parts.minor}.${parts.patch}`;\n\treturn parts.prerelease === null ? base : `${base}-${parts.prerelease}`;\n}\n\nfunction partsFromMatch(match: RegExpMatchArray): VersionParts {\n\treturn {\n\t\tmajor: Number.parseInt(match[1] as string, 10),\n\t\tminor: Number.parseInt(match[2] as string, 10),\n\t\tpatch: Number.parseInt(match[3] as string, 10),\n\t\tprerelease: match[4] === undefined ? null : Number.parseInt(match[4], 10),\n\t};\n}\n\nfunction parseVersion(version: string): VersionParts | null {\n\tconst match = version.trim().match(RELEASE_VERSION_RE);\n\treturn match ? partsFromMatch(match) : null;\n}\n\nfunction parseVersionHeader(line: string): VersionParts | null {\n\tconst match = line.match(CHANGELOG_VERSION_HEADER_RE);\n\treturn match ? partsFromMatch(match) : null;\n}\n\nfunction createChangelogEntry(version: VersionParts, lines: string[]): ChangelogEntry {\n\treturn {\n\t\t...version,\n\t\tversion: formatVersion(version),\n\t\tcontent: lines.join(\"\\n\").trim(),\n\t};\n}\n\n/**\n * Parse changelog entries from CHANGELOG.md\n * Scans for ## lines and collects content until next ## or EOF\n */\nexport function parseChangelog(changelogPath: string): ChangelogEntry[] {\n\tif (!existsSync(changelogPath)) {\n\t\treturn [];\n\t}\n\n\ttry {\n\t\tconst content = readFileSync(changelogPath, \"utf-8\");\n\t\tconst lines = content.split(\"\\n\");\n\t\tconst entries: ChangelogEntry[] = [];\n\n\t\tlet currentLines: string[] = [];\n\t\tlet currentVersion: VersionParts | null = null;\n\n\t\tfor (const line of lines) {\n\t\t\t// Check if this is a version header (## [x.y.z] ...)\n\t\t\tif (line.startsWith(\"## \")) {\n\t\t\t\t// Save previous entry if exists\n\t\t\t\tif (currentVersion && currentLines.length > 0) {\n\t\t\t\t\tentries.push(createChangelogEntry(currentVersion, currentLines));\n\t\t\t\t}\n\n\t\t\t\t// Try to parse version from this line\n\t\t\t\tconst versionParts = parseVersionHeader(line);\n\t\t\t\tif (versionParts) {\n\t\t\t\t\tcurrentVersion = versionParts;\n\t\t\t\t\tcurrentLines = [line];\n\t\t\t\t} else {\n\t\t\t\t\t// Reset if we can't parse version\n\t\t\t\t\tcurrentVersion = null;\n\t\t\t\t\tcurrentLines = [];\n\t\t\t\t}\n\t\t\t} else if (currentVersion) {\n\t\t\t\t// Collect lines for current version\n\t\t\t\tcurrentLines.push(line);\n\t\t\t}\n\t\t}\n\n\t\t// Save last entry\n\t\tif (currentVersion && currentLines.length > 0) {\n\t\t\tentries.push(createChangelogEntry(currentVersion, currentLines));\n\t\t}\n\n\t\treturn entries;\n\t} catch (error) {\n\t\tconsole.error(`Warning: Could not parse changelog: ${error}`);\n\t\treturn [];\n\t}\n}\n\n/**\n * Compare versions. Returns: -1 if v1 < v2, 0 if v1 === v2, 1 if v1 > v2\n */\nexport function compareVersions(v1: VersionParts, v2: VersionParts): number {\n\tif (v1.major !== v2.major) return v1.major - v2.major;\n\tif (v1.minor !== v2.minor) return v1.minor - v2.minor;\n\tif (v1.patch !== v2.patch) return v1.patch - v2.patch;\n\tif (v1.prerelease === v2.prerelease) return 0;\n\tif (v1.prerelease === null) return 1;\n\tif (v2.prerelease === null) return -1;\n\treturn v1.prerelease - v2.prerelease;\n}\n\n/**\n * Get entries newer than lastVersion, optionally bounded by currentVersion.\n *\n * Atomic uses numeric prereleases (for example, 0.8.1-0) and started its own\n * version line above the upstream Pi changelog history. When currentVersion is\n * provided, changelog order wins over semantic version filtering so historical\n * upstream entries like 0.74.0 or an old 0.10.0 section are not treated as\n * newer Atomic releases.\n */\nfunction findVersionIndex(entries: ChangelogEntry[], version: string): number {\n\tconst target = parseVersion(version);\n\tif (!target) return -1;\n\treturn entries.findIndex((entry) => compareVersions(entry, target) === 0);\n}\n\nexport function getNewEntries(\n\tentries: ChangelogEntry[],\n\tlastVersion: string,\n\tcurrentVersion?: string,\n): ChangelogEntry[] {\n\tif (currentVersion) {\n\t\tconst currentIndex = findVersionIndex(entries, currentVersion);\n\t\tif (currentIndex === -1) return [];\n\n\t\tconst lastIndex = findVersionIndex(entries, lastVersion);\n\t\tif (lastIndex !== -1) {\n\t\t\treturn currentIndex < lastIndex ? entries.slice(currentIndex, lastIndex) : [];\n\t\t}\n\n\t\tconst currentEntry = entries[currentIndex];\n\t\treturn currentIndex === 0 && currentEntry ? [currentEntry] : [];\n\t}\n\n\tconst last = parseVersion(lastVersion) ?? { major: 0, minor: 0, patch: 0, prerelease: null };\n\treturn entries.filter((entry) => compareVersions(entry, last) > 0);\n}\n\nexport function getEntriesForVersion(entries: ChangelogEntry[], version: string): ChangelogEntry[] {\n\tconst target = parseVersion(version);\n\tif (!target) return [];\n\treturn entries.filter((entry) => compareVersions(entry, target) === 0);\n}\n\n// Re-export getChangelogPath from paths.ts for convenience\nexport { getChangelogPath } from \"../config.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"changelog.js","sourceRoot":"","sources":["../../src/utils/changelog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAc9C,+EAA+E;AAC/E,gFAAgF;AAChF,kFAAkF;AAClF,iFAAiF;AACjF,oBAAoB;AACpB,MAAM,kBAAkB,GAAG,kFAAkF,CAAC;AAC9G,MAAM,2BAA2B,GAChC,sFAAsF,CAAC;AAMx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,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACxE,CAAC;AAED,2DAA2D;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC","sourcesContent":["import { existsSync, readFileSync } from \"fs\";\n\nexport interface VersionParts {\n\tmajor: number;\n\tminor: number;\n\tpatch: number;\n\tprerelease: number | null;\n}\n\nexport interface ChangelogEntry extends VersionParts {\n\tversion: string;\n\tcontent: string;\n}\n\n// The prerelease group accepts BOTH the legacy numeric form (`-N`) and the new\n// `-alpha.N` convention while capturing the numeric revision. The outer capture\n// group preserves the raw version substring so each entry's `version` round-trips\n// faithfully (a `0.8.1-0` header stays `0.8.1-0`; a `0.8.2-alpha.1` header stays\n// `0.8.2-alpha.1`).\nconst RELEASE_VERSION_RE = /^(?:v)?((0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-(?:alpha\\.)?(0|[1-9]\\d*))?)$/;\nconst CHANGELOG_VERSION_HEADER_RE =\n\t/^##\\s+\\[?((0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-(?:alpha\\.)?(0|[1-9]\\d*))?)\\]?/;\n\ninterface ParsedVersion extends VersionParts {\n\tversion: string;\n}\n\nfunction parsedVersionFromMatch(match: RegExpMatchArray): ParsedVersion {\n\treturn {\n\t\tversion: match[1] as string,\n\t\tmajor: Number.parseInt(match[2] as string, 10),\n\t\tminor: Number.parseInt(match[3] as string, 10),\n\t\tpatch: Number.parseInt(match[4] as string, 10),\n\t\tprerelease: match[5] === undefined ? null : Number.parseInt(match[5], 10),\n\t};\n}\n\nfunction parseVersion(version: string): VersionParts | null {\n\tconst match = version.trim().match(RELEASE_VERSION_RE);\n\treturn match ? parsedVersionFromMatch(match) : null;\n}\n\nfunction parseVersionHeader(line: string): ParsedVersion | null {\n\tconst match = line.match(CHANGELOG_VERSION_HEADER_RE);\n\treturn match ? parsedVersionFromMatch(match) : null;\n}\n\nfunction createChangelogEntry(version: ParsedVersion, lines: string[]): ChangelogEntry {\n\treturn {\n\t\tmajor: version.major,\n\t\tminor: version.minor,\n\t\tpatch: version.patch,\n\t\tprerelease: version.prerelease,\n\t\tversion: version.version,\n\t\tcontent: lines.join(\"\\n\").trim(),\n\t};\n}\n\n/**\n * Parse changelog entries from CHANGELOG.md\n * Scans for ## lines and collects content until next ## or EOF\n */\nexport function parseChangelog(changelogPath: string): ChangelogEntry[] {\n\tif (!existsSync(changelogPath)) {\n\t\treturn [];\n\t}\n\n\ttry {\n\t\tconst content = readFileSync(changelogPath, \"utf-8\");\n\t\tconst lines = content.split(\"\\n\");\n\t\tconst entries: ChangelogEntry[] = [];\n\n\t\tlet currentLines: string[] = [];\n\t\tlet currentVersion: ParsedVersion | null = null;\n\n\t\tfor (const line of lines) {\n\t\t\t// Check if this is a version header (## [x.y.z] ...)\n\t\t\tif (line.startsWith(\"## \")) {\n\t\t\t\t// Save previous entry if exists\n\t\t\t\tif (currentVersion && currentLines.length > 0) {\n\t\t\t\t\tentries.push(createChangelogEntry(currentVersion, currentLines));\n\t\t\t\t}\n\n\t\t\t\t// Try to parse version from this line\n\t\t\t\tconst versionParts = parseVersionHeader(line);\n\t\t\t\tif (versionParts) {\n\t\t\t\t\tcurrentVersion = versionParts;\n\t\t\t\t\tcurrentLines = [line];\n\t\t\t\t} else {\n\t\t\t\t\t// Reset if we can't parse version\n\t\t\t\t\tcurrentVersion = null;\n\t\t\t\t\tcurrentLines = [];\n\t\t\t\t}\n\t\t\t} else if (currentVersion) {\n\t\t\t\t// Collect lines for current version\n\t\t\t\tcurrentLines.push(line);\n\t\t\t}\n\t\t}\n\n\t\t// Save last entry\n\t\tif (currentVersion && currentLines.length > 0) {\n\t\t\tentries.push(createChangelogEntry(currentVersion, currentLines));\n\t\t}\n\n\t\treturn entries;\n\t} catch (error) {\n\t\tconsole.error(`Warning: Could not parse changelog: ${error}`);\n\t\treturn [];\n\t}\n}\n\n/**\n * Compare versions. Returns: -1 if v1 < v2, 0 if v1 === v2, 1 if v1 > v2\n */\nexport function compareVersions(v1: VersionParts, v2: VersionParts): number {\n\tif (v1.major !== v2.major) return v1.major - v2.major;\n\tif (v1.minor !== v2.minor) return v1.minor - v2.minor;\n\tif (v1.patch !== v2.patch) return v1.patch - v2.patch;\n\tif (v1.prerelease === v2.prerelease) return 0;\n\tif (v1.prerelease === null) return 1;\n\tif (v2.prerelease === null) return -1;\n\treturn v1.prerelease - v2.prerelease;\n}\n\n/**\n * Get entries newer than lastVersion, optionally bounded by currentVersion.\n *\n * Atomic uses alpha prereleases (for example, 0.8.2-alpha.1, with the revision\n * starting at 1) while legacy numeric prerelease entries (for example, 0.8.1-0)\n * remain parseable, and started its own\n * version line above the upstream Pi changelog history. When currentVersion is\n * provided, changelog order wins over semantic version filtering so historical\n * upstream entries like 0.74.0 or an old 0.10.0 section are not treated as\n * newer Atomic releases.\n */\nfunction findVersionIndex(entries: ChangelogEntry[], version: string): number {\n\tconst target = parseVersion(version);\n\tif (!target) return -1;\n\treturn entries.findIndex((entry) => compareVersions(entry, target) === 0);\n}\n\nexport function getNewEntries(\n\tentries: ChangelogEntry[],\n\tlastVersion: string,\n\tcurrentVersion?: string,\n): ChangelogEntry[] {\n\tif (currentVersion) {\n\t\tconst currentIndex = findVersionIndex(entries, currentVersion);\n\t\tif (currentIndex === -1) return [];\n\n\t\tconst lastIndex = findVersionIndex(entries, lastVersion);\n\t\tif (lastIndex !== -1) {\n\t\t\treturn currentIndex < lastIndex ? entries.slice(currentIndex, lastIndex) : [];\n\t\t}\n\n\t\tconst currentEntry = entries[currentIndex];\n\t\treturn currentIndex === 0 && currentEntry ? [currentEntry] : [];\n\t}\n\n\tconst last = parseVersion(lastVersion) ?? { major: 0, minor: 0, patch: 0, prerelease: null };\n\treturn entries.filter((entry) => compareVersions(entry, last) > 0);\n}\n\nexport function getEntriesForVersion(entries: ChangelogEntry[], version: string): ChangelogEntry[] {\n\tconst target = parseVersion(version);\n\tif (!target) return [];\n\treturn entries.filter((entry) => compareVersions(entry, target) === 0);\n}\n\n// Re-export getChangelogPath from paths.ts for convenience\nexport { getChangelogPath } from \"../config.ts\";\n"]}
|
package/docs/extensions.md
CHANGED
|
@@ -274,14 +274,14 @@ This pattern makes the fetched models available during normal startup and to `at
|
|
|
274
274
|
}
|
|
275
275
|
```
|
|
276
276
|
|
|
277
|
-
The manifest key is the app name
|
|
277
|
+
The manifest key is the configured Atomic app name (`atomic` here, from the running Atomic package/config), not the extension package's own `"name"` field. The legacy `pi` key is still accepted as a compatibility shim. Run `npm install`, `bun install`, or `pnpm install` in the extension directory, then imports from `node_modules/` work automatically.
|
|
278
278
|
|
|
279
279
|
## Events
|
|
280
280
|
|
|
281
281
|
### Lifecycle Overview
|
|
282
282
|
|
|
283
283
|
```
|
|
284
|
-
|
|
284
|
+
Atomic starts
|
|
285
285
|
│
|
|
286
286
|
├─► session_start { reason: "startup" }
|
|
287
287
|
└─► resources_discover { reason: "startup" }
|
package/docs/packages.md
CHANGED
|
@@ -137,12 +137,12 @@ Paths are relative to the package root. Arrays support glob patterns and `!exclu
|
|
|
137
137
|
|
|
138
138
|
### Gallery Metadata
|
|
139
139
|
|
|
140
|
-
The
|
|
140
|
+
The package gallery currently recognizes legacy `pi-package` metadata, while new Atomic packages should also include `atomic-package`. Add `video` or `image` fields to show a preview:
|
|
141
141
|
|
|
142
142
|
```json
|
|
143
143
|
{
|
|
144
144
|
"name": "my-package",
|
|
145
|
-
"keywords": ["
|
|
145
|
+
"keywords": ["atomic-package", "pi-package"],
|
|
146
146
|
"atomic": {
|
|
147
147
|
"extensions": ["./extensions"],
|
|
148
148
|
"video": "https://example.com/demo.mp4",
|
|
@@ -166,14 +166,18 @@ If no app manifest (`atomic`, or legacy `pi`) is present, Atomic auto-discovers
|
|
|
166
166
|
- `skills/` recursively finds `SKILL.md` folders and loads top-level `.md` files as skills
|
|
167
167
|
- `prompts/` loads `.md` files
|
|
168
168
|
- `themes/` loads `.json` files
|
|
169
|
-
- `workflows/` loads workflow SDK files (`.ts`, `.js`, `.mjs`, `.cjs`); `workflow/` is also accepted as a singular alias
|
|
169
|
+
- `workflows/` loads workflow SDK files (`.ts`, `.js`, `.mjs`, `.cjs`); `workflow/` is also accepted as a singular alias. Workflow files should `import { defineWorkflow, Type } from "@bastani/workflows"` and export `defineWorkflow(...).compile()` output. TypeScript package authors do not need a local `.d.ts` or `declare module` shim for the SDK import.
|
|
170
|
+
|
|
171
|
+
When a package manifest exists, declared resource arrays normally define what loads. Workflows are the exception: if `atomic.workflows` / legacy `pi.workflows` is omitted, Atomic still checks conventional `workflows/` and `workflow/` directories.
|
|
170
172
|
|
|
171
173
|
## Dependencies
|
|
172
174
|
|
|
173
|
-
Third
|
|
175
|
+
Third-party runtime dependencies belong in `dependencies` in `package.json`. Dependencies that do not register extensions, skills, prompt templates, themes, or workflows also belong in `dependencies`. When Atomic installs a package from npm or git, it runs the configured npm-compatible install command, so those dependencies are installed automatically.
|
|
174
176
|
|
|
175
177
|
Atomic bundles core packages for extensions and skills. If you import any of these, list them in `peerDependencies` with a `"*"` range and do not bundle them: `@earendil-works/pi-ai`, `@earendil-works/pi-agent-core`, `@bastani/atomic`, `@earendil-works/pi-tui`, `typebox`.
|
|
176
178
|
|
|
179
|
+
Workflow packages should author workflow files with `import { defineWorkflow, Type } from "@bastani/workflows"` and export definitions produced by `defineWorkflow(...).compile()`. Do not use the removed `runWorkflow` object-form API, and do not hand-roll objects with `__piWorkflow: true`; discovery accepts only compiled definitions.
|
|
180
|
+
|
|
177
181
|
Other Atomic packages must be bundled in your tarball. Add them to `dependencies` and `bundledDependencies`, then reference their resources through `node_modules/` paths. Atomic loads packages with separate module roots, so separate installs do not collide or share modules.
|
|
178
182
|
|
|
179
183
|
Example:
|
package/docs/subagents.md
CHANGED
|
@@ -150,6 +150,36 @@ Agents can define ordered `fallbackModels` for retryable provider or model failu
|
|
|
150
150
|
|
|
151
151
|
Fallbacks do not retry ordinary task failures, validation failures, tool failures, cancellations, or workflow-code errors. Because a fallback may send the same prompt and context to a different provider, choose models that match your cost, privacy, and data-handling requirements.
|
|
152
152
|
|
|
153
|
+
Each candidate can also carry its own reasoning effort — see [Reasoning levels](#reasoning-levels).
|
|
154
|
+
|
|
155
|
+
## Reasoning levels
|
|
156
|
+
|
|
157
|
+
Set the reasoning (thinking) effort for each model candidate with a `model_name:thinking_effort` suffix on `model` and on every `fallbackModels` entry. Valid efforts are `off`, `minimal`, `low`, `medium`, `high`, and `xhigh` — the same shorthand used by `atomic --model sonnet:high`.
|
|
158
|
+
|
|
159
|
+
```markdown
|
|
160
|
+
---
|
|
161
|
+
name: deep-reviewer
|
|
162
|
+
description: Adversarial reviewer for risky diffs
|
|
163
|
+
tools: read, grep, bash
|
|
164
|
+
model: anthropic/claude-sonnet-4:high
|
|
165
|
+
fallbackModels: openai/gpt-5:medium, anthropic/claude-haiku-4-5:off
|
|
166
|
+
---
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Because the effort travels with each model string, every primary and fallback candidate is self-contained: a fallback can run at a different effort than the primary, so a high-effort primary degrades gracefully to a cheaper, lower-effort fallback.
|
|
170
|
+
|
|
171
|
+
**Migrate off the legacy `thinking` field.** The separate `thinking:` frontmatter field is deprecated. It still works as a default for any candidate that has no suffix, and a suffix always wins, but new agents should encode the effort directly on `model` and `fallbackModels`:
|
|
172
|
+
|
|
173
|
+
```diff
|
|
174
|
+
-model: openai/gpt-5.5
|
|
175
|
+
-fallbackModels: anthropic/claude-opus-4-8
|
|
176
|
+
-thinking: xhigh
|
|
177
|
+
+model: openai/gpt-5.5:xhigh
|
|
178
|
+
+fallbackModels: anthropic/claude-opus-4-8:xhigh
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
`fallbackThinkingLevels` exists only as an optional compatibility helper: it is aligned by index to `fallbackModels` and supplies a fallback candidate's effort only when that fallback entry has no suffix. Prefer suffixed model strings instead. Attempt metadata reports the resolved model and the effective reasoning effort used for each attempt.
|
|
182
|
+
|
|
153
183
|
## Related docs
|
|
154
184
|
|
|
155
185
|
- [Workflows](/workflows) for multi-stage reusable automation.
|
package/docs/workflows.md
CHANGED
|
@@ -378,7 +378,7 @@ If the task is only deterministic TypeScript with no LLM/session stage, use a sc
|
|
|
378
378
|
| Run, inspect, attach to, pause, interrupt, resume, or check status for an existing workflow | `/workflow ...` or `workflow({ action: ... })` |
|
|
379
379
|
| Implement a small-to-medium scope change with an identifiable work surface, exact outcome, and named validation | `/workflow goal objective="..."` so Atomic keeps the run bounded, captures receipts in a goal ledger, gates completion through reviewers, and stops as `complete`, `blocked`, or `needs_human` |
|
|
380
380
|
| Plan and execute a larger migration, broad refactor, multi-package change, or spec-to-PR effort | `/workflow ralph prompt="..."` so Atomic can plan the approach, delegate implementation through sub-agents, simplify, review, iterate, and prepare a pull-request report |
|
|
381
|
-
| Create or edit reusable automation | a TypeScript workflow definition
|
|
381
|
+
| Create or edit reusable automation | a TypeScript workflow definition exported from `defineWorkflow(...).compile()` |
|
|
382
382
|
| Track one-off work without saving a workflow file | direct `workflow({ task })`, `workflow({ tasks })`, or `workflow({ chain })` calls |
|
|
383
383
|
| Make a workflow robust | design the stage graph, context handoffs, artifacts, validation gates, model fallbacks, and human approval points before coding |
|
|
384
384
|
|
|
@@ -482,7 +482,7 @@ Atomic packages can ship workflows through package metadata or conventional dire
|
|
|
482
482
|
|
|
483
483
|
Paths are relative to the package root and may use glob patterns. Include `atomic-package` for Atomic package discovery and `pi-package` when you want compatibility with existing package-gallery tooling.
|
|
484
484
|
|
|
485
|
-
For new Atomic package examples, prefer `atomic.workflows` and `atomic.extensions`. `pi.workflows` and `pi.extensions` remain supported for compatibility with existing packages.
|
|
485
|
+
For new Atomic package examples, prefer `atomic.workflows` and `atomic.extensions`. `pi.workflows` and `pi.extensions` remain supported for compatibility with existing packages. Workflows can be declared with `atomic.workflows` or discovered from conventional `workflows/` / `workflow/` directories. Unlike other resource types, package workflows still fall back to conventional directories when a package manifest exists but omits the workflow key. App-level config prefers `atomicConfig` where available; legacy `piConfig` is still read as a shim.
|
|
486
486
|
|
|
487
487
|
Convention directory example:
|
|
488
488
|
|
|
@@ -841,7 +841,7 @@ Builder basics:
|
|
|
841
841
|
|
|
842
842
|
`prompt` and `task` are aliases for task text. Prefer `prompt` inside authored workflow files because it mirrors lower-level `stage.prompt(...)`; `task` remains useful in direct tool calls and chain examples.
|
|
843
843
|
|
|
844
|
-
|
|
844
|
+
Author workflows to create at least one tracked stage by calling `ctx.task()`, `ctx.chain()`, `ctx.parallel()`, `ctx.stage()`, or `ctx.workflow()` in the run body so each run has graph nodes to inspect, attach to, interrupt, resume, and render.
|
|
845
845
|
|
|
846
846
|
### Inputs
|
|
847
847
|
|
|
@@ -1181,7 +1181,7 @@ Common task/stage options include:
|
|
|
1181
1181
|
- `prompt` or `task`
|
|
1182
1182
|
- `previous` for small handoff context; use artifact paths plus `reads` for large outputs, logs, research bundles, or reviewer payloads
|
|
1183
1183
|
- `context: "fresh" | "fork"`, `forkFromSessionFile`
|
|
1184
|
-
- `model`, `fallbackModels`, `thinkingLevel`, `scopedModels`, `modelRegistry`
|
|
1184
|
+
- `model`, `fallbackModels`, `thinkingLevel`, `scopedModels`, `modelRegistry` — `model` and each `fallbackModels` entry accept a `model_name:thinking_effort` reasoning suffix; the standalone `thinkingLevel` is deprecated (see [Reasoning levels](#reasoning-levels))
|
|
1185
1185
|
- `tools`, `noTools`, `customTools`, `mcp: { allow?: string[], deny?: string[] }`
|
|
1186
1186
|
- `output`, `outputMode`, `reads`, `worktree`, `gitWorktreeDir`, `baseBranch`, `maxOutput`, `artifacts`, `sessionDir`, `cwd`, `agentDir`
|
|
1187
1187
|
- advanced host-supplied SDK seams: `authStorage`, `resourceLoader`, `sessionManager`, `settingsManager`, `sessionStartEvent`
|
|
@@ -1208,6 +1208,30 @@ For lower-level integrations, `@bastani/workflows` also exports `setupGitWorktre
|
|
|
1208
1208
|
|
|
1209
1209
|
`fallbackModels` retries transient provider/model failures with the primary `model` first, then each fallback, then the current Atomic-selected model when available. It is for rate limits, quota/auth/provider outages, unavailable models, network timeouts, and 5xx errors — not workflow-code errors, tool failures, validation failures, or cancellations.
|
|
1210
1210
|
|
|
1211
|
+
### Reasoning levels
|
|
1212
|
+
|
|
1213
|
+
Each `model` and `fallbackModels` entry accepts a `model_name:thinking_effort` suffix that sets the reasoning effort for that candidate (`off`, `minimal`, `low`, `medium`, `high`, `xhigh`). The effort travels with the model string, so a single fallback chain can mix efforts — for example a high-effort primary that degrades to lower-effort, cheaper fallbacks:
|
|
1214
|
+
|
|
1215
|
+
```ts
|
|
1216
|
+
await ctx.task("review", {
|
|
1217
|
+
task: "Review the diff",
|
|
1218
|
+
model: "anthropic/claude-sonnet-4:high",
|
|
1219
|
+
fallbackModels: ["openai/gpt-5:medium", "anthropic/claude-haiku-4-5:off"],
|
|
1220
|
+
});
|
|
1221
|
+
```
|
|
1222
|
+
|
|
1223
|
+
The standalone `thinkingLevel` stage option is deprecated. It still applies as a default to any candidate without a suffix, and when both are present the suffix wins, but new workflows should fold the effort into the model strings:
|
|
1224
|
+
|
|
1225
|
+
```diff
|
|
1226
|
+
- model: "openai/gpt-5.5",
|
|
1227
|
+
- fallbackModels: ["anthropic/claude-opus-4-8"],
|
|
1228
|
+
- thinkingLevel: "high",
|
|
1229
|
+
+ model: "openai/gpt-5.5:high",
|
|
1230
|
+
+ fallbackModels: ["anthropic/claude-opus-4-8:high"],
|
|
1231
|
+
```
|
|
1232
|
+
|
|
1233
|
+
This applies everywhere a stage accepts a model: direct `ctx.task`/`ctx.chain`/`ctx.parallel` options, `ctx.stage` options, builtin workflow stage definitions, and workflow parameters. `fallbackThinkingLevels` is an optional compatibility helper aligned by index to `fallbackModels`; it applies only to fallback entries that do not already carry a suffix. Each `WorkflowModelAttempt` reports the resolved model and the effective reasoning effort used for that attempt.
|
|
1234
|
+
|
|
1211
1235
|
## Programmatic Usage
|
|
1212
1236
|
|
|
1213
1237
|
`@bastani/workflows` is an Atomic package extension. It registers:
|
|
@@ -1215,29 +1239,23 @@ For lower-level integrations, `@bastani/workflows` also exports `setupGitWorktre
|
|
|
1215
1239
|
- `/workflow <name> key=value ...` for interactive named runs
|
|
1216
1240
|
- `/workflow connect|attach|pause|interrupt|resume|status|inputs|reload` for live control, inspection, and rediscovery
|
|
1217
1241
|
- the `workflow` tool for agent-initiated orchestration and direct one-off runs
|
|
1218
|
-
|
|
1242
|
+
Workflow definition files must export definitions produced by `defineWorkflow(...).compile()`. The former imperative object-form runner is not part of the public SDK, and authored workflow files cannot import `runWorkflow` from `@bastani/workflows`.
|
|
1219
1243
|
|
|
1220
|
-
|
|
1244
|
+
Standalone TypeScript workflow packages can import the typed SDK directly, with no hand-authored `.d.ts` or `declare module` shim:
|
|
1221
1245
|
|
|
1222
1246
|
```ts
|
|
1223
|
-
import {
|
|
1224
|
-
|
|
1225
|
-
const definition = {
|
|
1226
|
-
mode: "workflow",
|
|
1227
|
-
workflow: "deep-research-codebase",
|
|
1228
|
-
inputs: {
|
|
1229
|
-
prompt: "map workflow sdk",
|
|
1230
|
-
max_partitions: 1,
|
|
1231
|
-
max_concurrency: 4,
|
|
1232
|
-
},
|
|
1233
|
-
} as const;
|
|
1234
|
-
|
|
1235
|
-
const options: WorkflowOptions = {};
|
|
1247
|
+
import { defineWorkflow, Type } from "@bastani/workflows";
|
|
1236
1248
|
|
|
1237
|
-
|
|
1249
|
+
export default defineWorkflow("map-workflow-sdk")
|
|
1250
|
+
.input("prompt", Type.String({ default: "map workflow sdk" }))
|
|
1251
|
+
.run(async (ctx) => {
|
|
1252
|
+
await ctx.task("map", { prompt: ctx.inputs.prompt });
|
|
1253
|
+
return {};
|
|
1254
|
+
})
|
|
1255
|
+
.compile();
|
|
1238
1256
|
```
|
|
1239
1257
|
|
|
1240
|
-
The
|
|
1258
|
+
The `workflow` tool still supports direct one-off `task`, `tasks`, and `chain` modes. Direct chains support `chainName` for status/artifact grouping and `chainDir` as a shared directory for relative reads, outputs, and worktree diffs.
|
|
1241
1259
|
|
|
1242
1260
|
Use `createRegistry()` when code needs to group definitions explicitly:
|
|
1243
1261
|
|