@skaile/workspaces 1.10.1 → 1.10.3
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 +57 -0
- package/dist/{asset-feeds-FMV3SJVQ.js → asset-feeds-BQMXT42Z.js} +4 -4
- package/dist/{asset-feeds-FMV3SJVQ.js.map → asset-feeds-BQMXT42Z.js.map} +1 -1
- package/dist/asset-manager/index.js +1 -1
- package/dist/{chunk-2ZP6KIIQ.js → chunk-2QKVA5Y6.js} +2 -2
- package/dist/{chunk-2ZP6KIIQ.js.map → chunk-2QKVA5Y6.js.map} +1 -1
- package/dist/{chunk-TG4IJM6C.js → chunk-5RKAGH37.js} +131 -18
- package/dist/chunk-5RKAGH37.js.map +1 -0
- package/dist/{chunk-GEZMBQ3R.js → chunk-5RUKUVKQ.js} +3 -3
- package/dist/{chunk-GEZMBQ3R.js.map → chunk-5RUKUVKQ.js.map} +1 -1
- package/dist/{chunk-SMWXVW6Z.js → chunk-776EVMDG.js} +3 -3
- package/dist/{chunk-SMWXVW6Z.js.map → chunk-776EVMDG.js.map} +1 -1
- package/dist/{chunk-TR6E5JOF.js → chunk-7BRSWDKY.js} +6 -6
- package/dist/{chunk-TR6E5JOF.js.map → chunk-7BRSWDKY.js.map} +1 -1
- package/dist/{chunk-ZDRAMXBS.js → chunk-DFJUCT6V.js} +3 -3
- package/dist/{chunk-ZDRAMXBS.js.map → chunk-DFJUCT6V.js.map} +1 -1
- package/dist/{chunk-IFCHOBEF.js → chunk-H6ICUWWL.js} +6 -6
- package/dist/{chunk-IFCHOBEF.js.map → chunk-H6ICUWWL.js.map} +1 -1
- package/dist/{chunk-MMM6JBBQ.js → chunk-MCQHSNA2.js} +3 -3
- package/dist/{chunk-MMM6JBBQ.js.map → chunk-MCQHSNA2.js.map} +1 -1
- package/dist/{chunk-PU3FGN4T.js → chunk-QRHQY4IG.js} +2 -2
- package/dist/{chunk-PU3FGN4T.js.map → chunk-QRHQY4IG.js.map} +1 -1
- package/dist/{chunk-2257NSNY.js → chunk-YODB4IHP.js} +3 -2
- package/dist/chunk-YODB4IHP.js.map +1 -0
- package/dist/cli/index.js +24 -24
- package/dist/connectors/index.js +1 -1
- package/dist/{ensure-sources-OJ5GIRZF.js → ensure-sources-WL442SHF.js} +4 -4
- package/dist/{ensure-sources-OJ5GIRZF.js.map → ensure-sources-WL442SHF.js.map} +1 -1
- package/dist/factory-assets/connectors/box.js +1 -1
- package/dist/factory-assets/connectors/deploy.js +1 -1
- package/dist/factory-assets/connectors/devserver.js +1 -1
- package/dist/factory-assets/connectors/flow/adapter.d.ts.map +1 -1
- package/dist/factory-assets/connectors/flow/adapter.js +1 -1
- package/dist/factory-assets/connectors/flow/run-flow.js +2 -2
- package/dist/factory-assets/connectors/flow.js +1 -1
- package/dist/factory-assets/connectors/git.js +1 -1
- package/dist/factory-assets/connectors/gmail.js +1 -1
- package/dist/factory-assets/connectors/googledrive.js +1 -1
- package/dist/factory-assets/connectors/local.js +1 -1
- package/dist/factory-assets/connectors/mattermost.js +1 -1
- package/dist/factory-assets/connectors/memory.js +1 -1
- package/dist/factory-assets/connectors/minio.js +1 -1
- package/dist/factory-assets/connectors/postgres.js +1 -1
- package/dist/factory-assets/connectors/s3.js +1 -1
- package/dist/factory-assets/connectors/sharepoint.js +1 -1
- package/dist/factory-assets/connectors/sqlite.js +1 -1
- package/dist/factory-assets/connectors/static-server.js +1 -1
- package/dist/factory-assets/connectors/tunnel.js +1 -1
- package/dist/factory-assets/connectors/webdav.js +1 -1
- package/dist/factory-assets/connectors/xstate-store.js +1 -1
- package/dist/factory-assets/connectors/xstate.js +1 -1
- package/dist/{helpers-PS37RNFV.js → helpers-AE7TFRJD.js} +4 -4
- package/dist/{helpers-PS37RNFV.js.map → helpers-AE7TFRJD.js.map} +1 -1
- package/dist/{library-publish-CRG7JLDZ.js → library-publish-V4L2M5VY.js} +6 -6
- package/dist/{library-publish-CRG7JLDZ.js.map → library-publish-V4L2M5VY.js.map} +1 -1
- package/dist/{open-library-5SRCSBSY.js → open-library-KPK6NKIX.js} +5 -5
- package/dist/{open-library-5SRCSBSY.js.map → open-library-KPK6NKIX.js.map} +1 -1
- package/dist/{project-SM2VMQOZ.js → project-NIFONZRU.js} +5 -5
- package/dist/{project-SM2VMQOZ.js.map → project-NIFONZRU.js.map} +1 -1
- package/dist/runner/index.js +3 -3
- package/dist/runner/src/serve.d.ts +50 -2
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +1 -1
- package/dist/sdk/index.js +3 -3
- package/dist/sdk/runner.js +3 -3
- package/dist/{source-Y7ZTBG2U.js → source-5IAXOWCU.js} +6 -6
- package/dist/{source-Y7ZTBG2U.js.map → source-5IAXOWCU.js.map} +1 -1
- package/dist/{source-manifest-publish-SXJ6LF4S.js → source-manifest-publish-UJM6D3Y7.js} +7 -7
- package/dist/{source-manifest-publish-SXJ6LF4S.js.map → source-manifest-publish-UJM6D3Y7.js.map} +1 -1
- package/dist/tui/index.js +3 -3
- package/dist/workspace-plugin/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2257NSNY.js.map +0 -1
- package/dist/chunk-TG4IJM6C.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.10.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#408](https://github.com/skaile-ai/workspaces/pull/408) [`b0e386f`](https://github.com/skaile-ai/workspaces/commit/b0e386f206f7a53b2d25b6cfb6ff1b4e3f909b19) Thanks [@peteralbert](https://github.com/peteralbert)! - Fix a shared-reference snapshot corruption in `FlowAdapter.mutate()` that could
|
|
8
|
+
drop `state_changed` signals. After a signaling mutation, `lastSignaledExecution`
|
|
9
|
+
aliases the live `execution` object; the next mutation's in-place
|
|
10
|
+
`nodes[x] = {...}` reassignment mutated that "previous" snapshot before
|
|
11
|
+
`computeStimulus` diffed it, so any transition whose only change is a
|
|
12
|
+
non-fast-path field (e.g. an approved-only `approval.decision` flip) compared
|
|
13
|
+
equal and produced no signal — an intermittent missed turn kick.
|
|
14
|
+
|
|
15
|
+
`mutate()` now shallow-clones the top-level snapshot and its `nodes` map before
|
|
16
|
+
running the mutator, so the mutator can no longer corrupt the previously-signaled
|
|
17
|
+
snapshot. No behaviour change for mutations that already signalled. No
|
|
18
|
+
protocol/envelope/flow-contract change.
|
|
19
|
+
|
|
20
|
+
- [#409](https://github.com/skaile-ai/workspaces/pull/409) [`70f0efd`](https://github.com/skaile-ai/workspaces/commit/70f0efdbf65c2803a72fdf084ec45fe8fcd0b4f1) Thanks [@peteralbert](https://github.com/peteralbert)! - Replay live store snapshots to a newly-attached subscriber, fixing cold-spawn
|
|
21
|
+
warmup event loss. Host-op `state_changed` events (flow mutations, shared-state
|
|
22
|
+
changes) fired in the first ~15-20s after a cold `skaile serve` spawn were
|
|
23
|
+
dropped: `sendEvent` is fire-and-forward and the sole `transport.onConnect`
|
|
24
|
+
handler emitted only availability, never state, so anything emitted before the
|
|
25
|
+
host's sync loop attached was lost forever.
|
|
26
|
+
|
|
27
|
+
A second `onConnect` handler now replays the CURRENT snapshot of every live
|
|
28
|
+
state-bearing store (flow stores read the authoritative FlowExecution off the
|
|
29
|
+
adapter; shared-state stores identified by the xstate-store `onStoreChange` hook,
|
|
30
|
+
read via `get`; git/mount/MCP skipped). Snapshots are idempotent latest-wins on
|
|
31
|
+
the host, so a late subscriber converges to the same state an early one holds and
|
|
32
|
+
a reconnect re-applies identical state without divergence. Runs after
|
|
33
|
+
availability so the host learns the stores exist before their state arrives, and
|
|
34
|
+
is consistent with the session_init re-emit paths. No protocol/envelope/
|
|
35
|
+
flow-contract change.
|
|
36
|
+
|
|
37
|
+
## 1.10.2
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- [#406](https://github.com/skaile-ai/workspaces/pull/406) [`975dc26`](https://github.com/skaile-ai/workspaces/commit/975dc263aa581e9189e540afcb4afa6b15bbed48) Thanks [@peteralbert](https://github.com/peteralbert)! - Fix the HITL approve path: `applyApproval` / `applyInput` / `retryNode` now kick
|
|
42
|
+
a resume turn with the correct typed stimulus (workspaces#404). Previously an
|
|
43
|
+
approved gate could hang forever — the approved branch records the decision but
|
|
44
|
+
leaves `status = awaiting_approval` and relied on the generic
|
|
45
|
+
`mutate() -> computeStimulus() -> bus.signal()` path, which flattens everything
|
|
46
|
+
to `state_changed` and (for approvals, which leave `status`/`focus`/`done`
|
|
47
|
+
unchanged) can drop the signal entirely, so no turn was kicked.
|
|
48
|
+
|
|
49
|
+
The runner's `connector_mutate` dispatch now emits an explicit typed stimulus
|
|
50
|
+
(`approval_received` / `input_received` / `retry_requested`) after applying the
|
|
51
|
+
op, fire-and-forget — mirroring the op:start `flow_started` kick ([#399](https://github.com/skaile-ai/workspaces/issues/399)). This
|
|
52
|
+
also gives the agent the correct resume guidance instead of a bare
|
|
53
|
+
`state_changed`. `driveTurn` reconstructs those kinds and, when signals coalesce,
|
|
54
|
+
prefers the most-specific stimulus in the batch so a trailing `state_changed`
|
|
55
|
+
can't mask the resume stimulus. Reject/input/retry paths are unchanged. No
|
|
56
|
+
protocol/envelope/flow-contract change. (The underlying shared-reference quirk in
|
|
57
|
+
`FlowAdapter.mutate()` is tracked separately in [#405](https://github.com/skaile-ai/workspaces/issues/405); this fix is correct
|
|
58
|
+
independent of it.)
|
|
59
|
+
|
|
3
60
|
## 1.10.1
|
|
4
61
|
|
|
5
62
|
### Patch Changes
|
|
@@ -64,7 +64,7 @@ async function libraryAssets() {
|
|
|
64
64
|
const domains = [];
|
|
65
65
|
try {
|
|
66
66
|
const [{ openLibraryManager }, { skaileHomeDir }, { getGlobalCacheDir }] = await Promise.all([
|
|
67
|
-
import('./open-library-
|
|
67
|
+
import('./open-library-KPK6NKIX.js'),
|
|
68
68
|
import('./library/index.js'),
|
|
69
69
|
import('./core/index.js')
|
|
70
70
|
]);
|
|
@@ -97,7 +97,7 @@ async function libraryAssets() {
|
|
|
97
97
|
async function storeAssets(projectDir) {
|
|
98
98
|
const notes = [];
|
|
99
99
|
try {
|
|
100
|
-
const { resolveCatalogSource } = await import('./open-library-
|
|
100
|
+
const { resolveCatalogSource } = await import('./open-library-KPK6NKIX.js');
|
|
101
101
|
const { source, close } = await resolveCatalogSource({ projectDir });
|
|
102
102
|
try {
|
|
103
103
|
const assets = await source.listAssets();
|
|
@@ -201,5 +201,5 @@ function dedupeBySlug(domains) {
|
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
export { gatherAssetFeeds };
|
|
204
|
-
//# sourceMappingURL=asset-feeds-
|
|
205
|
-
//# sourceMappingURL=asset-feeds-
|
|
204
|
+
//# sourceMappingURL=asset-feeds-BQMXT42Z.js.map
|
|
205
|
+
//# sourceMappingURL=asset-feeds-BQMXT42Z.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../cli/src/asset-feeds.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAqFA,SAAS,QAAQ,CAAA,EAAmB;AAClC,EAAA,OAAO,CAAA,CAAE,KAAA,CAAW,IAAA,CAAA,GAAG,CAAA,CAAE,KAAK,GAAG,CAAA;AACnC;AAGA,SAAS,cAAc,IAAA,EAA0B;AAC/C,EAAA,MAAM,MAAkB,EAAC;AACzB,EAAA,KAAA,MAAW,EAAE,IAAA,EAAM,QAAA,EAAU,MAAK,IAAK,OAAA,CAAQ,IAAI,CAAA,EAAG;AACpD,IAAA,IAAI,SAAS,kBAAA,EAAoB;AACjC,IAAA,IAAI;AACF,MAAA,MAAM,EAAE,IAAA,EAAK,GAAI,iBAAiB,YAAA,CAAa,QAAA,EAAU,MAAM,CAAC,CAAA;AAChE,MAAA,GAAA,CAAI,IAAA,CAAK,cAAc,OAAA,CAAa,IAAA,CAAA,QAAA,CAAS,MAAM,QAAQ,CAAC,CAAA,EAAG,IAAI,CAAC,CAAA;AAAA,IACt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EAAA,OAAO,GAAA;AACT","file":"asset-feeds-FMV3SJVQ.js","sourcesContent":["/**\n * asset-feeds.ts — gather installable assets from every feed the manage TUI\n * surfaces.\n *\n * Four feeds, normalized into `CatalogEntry`:\n * - **Project sources** — `skaile.yaml` `sources:` entries (scanned via\n * `AssetManager.search()`; the new `sources:` field is merged into the\n * legacy repositories map in `AssetManager.loadConfig`).\n * - **Local libraries** — user authoring places from `LocalIndex` (filesystem\n * scan of each library's `path`).\n * - **Factory assets** — the bundled first-party `factory-assets` tree\n * (`factoryAssetRoots()`), scanned from disk. Always present; no network.\n * - **Remote store** — the configured catalog source when `catalog.url` is\n * not `local`. Failures are non-fatal — they surface as notes.\n */\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport {\n type AssetKind,\n type CatalogDomain,\n type CatalogEntry,\n factoryAssetRoots,\n parseFrontmatter,\n scanRepo,\n walkDir,\n} from \"@skaile/workspaces/core\";\nimport {\n assignDomain,\n buildDomainIndex,\n DOMAIN_MD_FILENAME,\n type DomainMd,\n parseDomainMd,\n} from \"@skaile/workspaces/discovery\";\n\n/** One non-fatal note returned to the caller for surfacing in the UI. */\nexport interface FeedNote {\n feed: \"sources\" | \"libraries\" | \"store\" | \"factory\";\n message: string;\n}\n\n/**\n * Which feed an asset came from. This is the top-level grouping axis in the\n * manage TUI (\"where is this skill coming from?\") and is intentionally distinct\n * from `publisher` (asset-intrinsic identity): the same publisher can legitimately\n * appear under more than one origin (e.g. a github repo you added as a `source`\n * that is also listed in the remote `store`).\n */\nexport type AssetOrigin = \"source\" | \"library\" | \"factory\" | \"store\";\n\n/** A catalog entry tagged with the feed it was gathered from. */\nexport interface OriginEntry {\n origin: AssetOrigin;\n entry: CatalogEntry;\n /**\n * Second-level grouping label for the manage tree. Defaults (when unset) to the\n * entry's `publisher`; the source feed sets it to the source's short repo name\n * so the Sources band groups by source — \"which repo did this come from\" — not\n * by the asset-intrinsic publisher.\n */\n group?: string;\n}\n\nexport interface AssetFeedResult {\n entries: OriginEntry[];\n /**\n * Display-only domain metadata, keyed (by the consumer) on `slug`. Populated\n * from the store's `catalog.listDomains` when the connected catalog source\n * exposes it; empty otherwise. The manage TUI joins `entry.domainSlug` → a\n * domain for grouping headers, descriptions, and relation badges.\n */\n domains: CatalogDomain[];\n notes: FeedNote[];\n}\n\n// ── Domain stamping (on-disk feeds) ──────────────────────────────────────────\n//\n// `scanRepo` (the source / library / factory scan path) does not read the\n// `DOMAIN.md` sidecars, so its entries arrive with no `domainSlug` and render\n// flat under their publisher band. We re-derive the grouping here from the\n// root's `DOMAIN.md` files (the same sidecars the remote store computes\n// server-side), and fall back to the repo/source name for any entry no domain\n// claims so it still groups instead of landing in the synthetic \"no domain\" pile.\n\n/** Repo-relative POSIX path (DOMAIN.md slugs are matched whole-segment, `/`-joined). */\nfunction toPosix(p: string): string {\n return p.split(path.sep).join(\"/\");\n}\n\n/** Parse every `DOMAIN.md` sidecar under `root` into a {@link DomainMd}. */\nfunction loadDomainMds(root: string): DomainMd[] {\n const out: DomainMd[] = [];\n for (const { path: filePath, name } of walkDir(root)) {\n if (name !== DOMAIN_MD_FILENAME) continue;\n try {\n const { data } = parseFrontmatter(readFileSync(filePath, \"utf8\"));\n out.push(parseDomainMd(toPosix(path.relative(root, filePath)), data));\n } catch {}\n }\n return out;\n}\n\n/**\n * Stamp `domainSlug` onto every entry scanned from `root` using the root's\n * `DOMAIN.md` sidecars. Returns the `CatalogDomain` registry for the real\n * domains, plus a synthetic fallback domain when any entry used the fallback.\n * Mutates `entries` in place (sets `entry.domainSlug`).\n *\n * `synthesizeFallback` (default true): entries no domain claims fall back to\n * `fallbackSlug` (the repo/source name). Pass `false` when the caller already\n * groups these entries one level up (e.g. the source feed groups by source\n * node) — unmatched entries then get no domain (`\"\"`) and hang directly under\n * that parent, instead of nesting under a same-named fallback domain.\n */\nfunction stampDomains(\n root: string,\n fallbackSlug: string,\n entries: CatalogEntry[],\n synthesizeFallback = true,\n): CatalogDomain[] {\n const domainMds = loadDomainMds(root);\n const assignables = entries.map((entry) => ({\n entry,\n ref: `${entry.kind}:${entry.name}`,\n relativePath: toPosix(path.relative(root, entry.source)),\n }));\n\n let usedFallback = false;\n for (const a of assignables) {\n const slug = assignDomain(a.relativePath, domainMds);\n if (slug) a.entry.domainSlug = slug;\n else if (synthesizeFallback) {\n a.entry.domainSlug = fallbackSlug;\n usedFallback = true;\n } else a.entry.domainSlug = \"\";\n }\n\n const { index } = buildDomainIndex(assignables, domainMds);\n const catalog: CatalogDomain[] = Object.values(index).map((d) => ({\n slug: d.slug,\n title: d.title,\n ...(d.description ? { description: d.description } : {}),\n ...(d.relation ? { relation: d.relation } : {}),\n ...(d.order !== undefined ? { order: d.order } : {}),\n ...(d.recommended[0] ? { recommendedRef: d.recommended[0] } : {}),\n }));\n if (usedFallback) catalog.push({ slug: fallbackSlug, title: fallbackSlug });\n return catalog;\n}\n\n/**\n * Pull assets from local libraries (the authoring places under\n * `~/.skaile/libraries/<name>/`, not the `~/.skaile/cache/sources/` cache). Each\n * library's `path` is scanned with `scanRepo` and grouped under the bare library\n * name (`group: <name>`) so the manage TUI shows a clean `<name>` band — no\n * `library:` prefix and no redundant same-named fallback domain (mirrors the\n * source feed).\n */\nasync function libraryAssets(): Promise<{\n entries: OriginEntry[];\n domains: CatalogDomain[];\n notes: FeedNote[];\n}> {\n const notes: FeedNote[] = [];\n const domains: CatalogDomain[] = [];\n try {\n const [{ openLibraryManager }, { skaileHomeDir }, { getGlobalCacheDir }] = await Promise.all([\n import(\"./open-library.ts\"),\n import(\"@skaile/workspaces/library\"),\n import(\"@skaile/workspaces/core\"),\n ]);\n const { manager, close } = await openLibraryManager();\n try {\n // Authoring libraries are the rows that are NOT source clones. index.db\n // rows predating the cache migration still carry the legacy\n // ~/.skaile/sources path, so exclude both roots.\n const newRoot = getGlobalCacheDir();\n const legacyRoot = path.join(skaileHomeDir(), \"sources\");\n const libs = (await manager.listLibraries()).filter(\n (l) => !l.path.startsWith(newRoot) && !l.path.startsWith(legacyRoot),\n );\n const entries: OriginEntry[] = [];\n for (const lib of libs) {\n if (!existsSync(lib.path)) continue;\n // Scan + group under the bare library name. `synthesizeFallback: false`\n // (as the source feed does) keeps domainless assets directly under the\n // library band instead of a redundant same-named fallback domain.\n const libEntries = [...scanRepo(lib.path, lib.name)];\n domains.push(...stampDomains(lib.path, lib.name, libEntries, false));\n for (const entry of libEntries) entries.push({ origin: \"library\", entry, group: lib.name });\n }\n return { entries, domains, notes };\n } finally {\n close();\n }\n } catch (err) {\n notes.push({\n feed: \"libraries\",\n message: err instanceof Error ? err.message : String(err),\n });\n return { entries: [], domains, notes };\n }\n}\n\n/**\n * Pull a (best-effort) snapshot of the connected remote store catalog.\n *\n * - Returns no entries when the resolved catalog is local-only or the host\n * is unreachable (the failure becomes a note, not an exception).\n * - Maps `CatalogAsset` → `CatalogEntry`, carrying `publisher`, `repo`, and\n * `category` straight through and using `source = \"store://<id>\"`; per-file\n * `source` paths are not available for remote assets so the canonical ref is\n * a stable placeholder.\n */\nasync function storeAssets(projectDir: string): Promise<{\n entries: CatalogEntry[];\n domains: CatalogDomain[];\n notes: FeedNote[];\n}> {\n const notes: FeedNote[] = [];\n try {\n const { resolveCatalogSource } = await import(\"./open-library.ts\");\n const { source, close } = await resolveCatalogSource({ projectDir });\n try {\n const assets = await source.listAssets();\n const entries: CatalogEntry[] = assets.map((a) => ({\n name: a.name,\n kind: (a.kind as AssetKind) ?? \"skill\",\n description: a.description ?? \"\",\n source: `store://${a.id}`,\n publisher: a.publisher,\n repo: a.repo,\n domainSlug: a.domainSlug,\n category: a.category,\n version: a.version,\n requires: [],\n dependencies: [],\n }));\n // Domains are optional on the catalog source — only the store backend\n // (post Part 4 `catalog.listDomains`) exposes them. Duck-type the call so\n // older sources and the local catalog degrade to no domains, not an error.\n const domains = await loadDomains(source);\n return { entries, domains, notes };\n } finally {\n close();\n }\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n // Local-only catalog throws a recognizable message — silence it; absence\n // is the user's choice, not an error.\n if (!/local/i.test(msg)) {\n notes.push({ feed: \"store\", message: msg });\n }\n return { entries: [], domains: [], notes };\n }\n}\n\n/** Optional `listDomains` capability — returns `[]` when the source lacks it. */\nasync function loadDomains(source: unknown): Promise<CatalogDomain[]> {\n const fn = (source as { listDomains?: () => Promise<CatalogDomain[]> }).listDomains;\n if (typeof fn !== \"function\") return [];\n const domains = await fn.call(source);\n return Array.isArray(domains) ? domains : [];\n}\n\n/** The slice of `AssetManager` the source feed needs (kept narrow for tests). */\ninterface AssetManagerLike {\n search: () => CatalogEntry[];\n searchRepoRoots: () => { repoName: string; root: string }[];\n}\n\n/**\n * Project-source feed: leans on `AssetManager.search()`, which now merges\n * `skaile.yaml`'s `sources:` field into the repositories map, then stamps\n * `DOMAIN.md`-derived domain grouping onto the scanned entries via\n * `searchRepoRoots()`.\n */\nfunction sourceAssets(am: AssetManagerLike): { entries: OriginEntry[]; domains: CatalogDomain[] } {\n // The bundled factory tree is injected into the repositories map as an implicit\n // source, so `am.search()` returns it too. It has its own `factory` origin band,\n // so drop it here — otherwise the same first-party skills list twice under Sources.\n const factoryPrefixes = factoryAssetRoots().map((r) => (r.endsWith(path.sep) ? r : r + path.sep));\n const isFactoryPath = (p: string) =>\n factoryPrefixes.some((fp) => p === fp.slice(0, -1) || p.startsWith(fp));\n\n const all = am.search().filter((e) => !isFactoryPath(e.source));\n const entries: OriginEntry[] = [];\n const domains: CatalogDomain[] = [];\n // Group each source's entries under the source node (its short repo name), not\n // the publisher: under Sources the navigational question is \"which repo did\n // this come from\". Each entry's `source` (absolute manifest path) lives under\n // exactly one declared root, so group + stamp by prefix. The cache slug is\n // URL-keyed `github.com/<org>/<repo>` — take the trailing segment.\n for (const { repoName, root } of am.searchRepoRoots()) {\n if (isFactoryPath(root)) continue;\n const prefix = root.endsWith(path.sep) ? root : root + path.sep;\n const owned = all.filter((e) => e.source === root || e.source.startsWith(prefix));\n if (owned.length === 0) continue;\n const sourceName = repoName.split(\"/\").pop() || repoName;\n // No synthetic fallback domain — the source node already groups these, so a\n // same-named fallback would just nest the source under itself.\n domains.push(...stampDomains(root, sourceName, owned, false));\n for (const entry of owned) entries.push({ origin: \"source\", entry, group: sourceName });\n }\n return { entries, domains };\n}\n\n/**\n * Factory-asset feed: scan the bundled first-party `factory-assets` tree(s)\n * resolved by `factoryAssetRoots()` (the `SKAILE_FACTORY_ASSETS_DIR` override\n * layer ahead of the bundled tree). Synchronous, no network — the entries are\n * the built-in skills / connectors / bundles that ship with `@skaile/workspaces`.\n * `factoryAssetRoots()` already dedupes, so the env override pointing at the\n * bundled dir collapses to one root.\n */\nfunction factoryAssets(): { entries: CatalogEntry[]; domains: CatalogDomain[]; notes: FeedNote[] } {\n const notes: FeedNote[] = [];\n const domains: CatalogDomain[] = [];\n try {\n const entries: CatalogEntry[] = [];\n for (const root of factoryAssetRoots()) {\n const rootEntries = [...scanRepo(root, \"skaile-factory\")];\n domains.push(...stampDomains(root, \"skaile-factory\", rootEntries));\n entries.push(...rootEntries);\n }\n return { entries, domains, notes };\n } catch (err) {\n notes.push({\n feed: \"factory\",\n message: err instanceof Error ? err.message : String(err),\n });\n return { entries: [], domains, notes };\n }\n}\n\n/** Tag a flat entry list with a single origin. */\nfunction tag(origin: AssetOrigin, entries: CatalogEntry[]): OriginEntry[] {\n return entries.map((entry) => ({ origin, entry }));\n}\n\n/**\n * Run all feeds and return a single normalized result.\n *\n * Feeds run in parallel where possible — the store fetch is the slow one\n * (one HTTP call) and is fired alongside the local library walk. The factory\n * scan is local + synchronous, so it runs inline.\n */\nexport async function gatherAssetFeeds(\n am: AssetManagerLike,\n projectDir: string,\n): Promise<AssetFeedResult> {\n const [libs, store] = await Promise.all([libraryAssets(), storeAssets(projectDir)]);\n const factory = factoryAssets();\n const src = sourceAssets(am);\n return {\n entries: [\n ...src.entries,\n ...libs.entries,\n ...tag(\"factory\", factory.entries),\n ...tag(\"store\", store.entries),\n ],\n // Store domains first (server-curated), then the on-disk feeds; dedupe by\n // slug, first-wins, so a store-served domain shadows a same-slug local one.\n domains: dedupeBySlug([...store.domains, ...src.domains, ...libs.domains, ...factory.domains]),\n notes: [...libs.notes, ...store.notes, ...factory.notes],\n };\n}\n\n/** First-wins dedupe of a domain list by `slug`. */\nfunction dedupeBySlug(domains: CatalogDomain[]): CatalogDomain[] {\n const seen = new Set<string>();\n const out: CatalogDomain[] = [];\n for (const d of domains) {\n if (seen.has(d.slug)) continue;\n seen.add(d.slug);\n out.push(d);\n }\n return out;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../cli/src/asset-feeds.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAqFA,SAAS,QAAQ,CAAA,EAAmB;AAClC,EAAA,OAAO,CAAA,CAAE,KAAA,CAAW,IAAA,CAAA,GAAG,CAAA,CAAE,KAAK,GAAG,CAAA;AACnC;AAGA,SAAS,cAAc,IAAA,EAA0B;AAC/C,EAAA,MAAM,MAAkB,EAAC;AACzB,EAAA,KAAA,MAAW,EAAE,IAAA,EAAM,QAAA,EAAU,MAAK,IAAK,OAAA,CAAQ,IAAI,CAAA,EAAG;AACpD,IAAA,IAAI,SAAS,kBAAA,EAAoB;AACjC,IAAA,IAAI;AACF,MAAA,MAAM,EAAE,IAAA,EAAK,GAAI,iBAAiB,YAAA,CAAa,QAAA,EAAU,MAAM,CAAC,CAAA;AAChE,MAAA,GAAA,CAAI,IAAA,CAAK,cAAc,OAAA,CAAa,IAAA,CAAA,QAAA,CAAS,MAAM,QAAQ,CAAC,CAAA,EAAG,IAAI,CAAC,CAAA;AAAA,IACtE,CAAA,CAAA,MAAQ;AAAA,IAAC;AAAA,EACX;AACA,EAAA,OAAO,GAAA;AACT;AAcA,SAAS,YAAA,CACP,IAAA,EACA,YAAA,EACA,OAAA,EACA,qBAAqB,IAAA,EACJ;AACjB,EAAA,MAAM,SAAA,GAAY,cAAc,IAAI,CAAA;AACpC,EAAA,MAAM,WAAA,GAAc,OAAA,CAAQ,GAAA,C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AA;AAClF,EAAA,MAAM,UAAU,aAAA,EAAc;AAC9B,EAAA,MAAM,GAAA,GAAM,aAAa,EAAE,CAAA;AAC3B,EAAA,OAAO;AAAA,IACL,OAAA,EAAS;AAAA,MACP,GAAG,GAAA,CAAI,OAAA;AAAA,MACP,GAAG,IAAA,CAAK,OAAA;AAAA,MACR,GAAG,GAAA,CAAI,SAAA,EAAW,OAAA,CAAQ,OAAO,CAAA;AAAA,MACjC,GAAG,GAAA,CAAI,OAAA,EAAS,KAAA,CAAM,OAAO;AAAA,KAC/B;AAAA;AAAA;AAAA,IAGA,OAAA,EAAS,YAAA,CAAa,CAAC,GAAG,MAAM,OAAA,EAAS,GAAG,GAAA,CAAI,OAAA,EAAS,GAAG,IAAA,CAAK,OAAA,EAAS,GAAG,OAAA,CAAQ,OAAO,CAAC,CAAA;AAAA,IAC7F,KAAA,EAAO,CAAC,GAAG,IAAA,CAAK,KAAA,EAAO,GAAG,KAAA,CAAM,KAAA,EAAO,GAAG,OAAA,CAAQ,KAAK;AAAA,GACzD;AACF;AAGA,SAAS,aAAa,OAAA,EAA2C;AAC/D,EAAA,MAAM,IAAA,uBAAW,GAAA,EAAY;AAC7B,EAAA,MAAM,MAAuB,EAAC;AAC9B,EAAA,KAAA,MAAW,KAAK,OAAA,EAAS;AACvB,IAAA,IAAI,IAAA,CAAK,GAAA,CAAI,CAAA,CAAE,IAAI,CAAA,EAAG;AACtB,IAAA,IAAA,CAAK,GAAA,CAAI,EAAE,IAAI,CAAA;AACf,IAAA,GAAA,CAAI,KAAK,CAAC,CAAA;AAAA,EACZ;AACA,EAAA,OAAO,GAAA;AACT","file":"asset-feeds-BQMXT42Z.js","sourcesContent":["/**\n * asset-feeds.ts — gather installable assets from every feed the manage TUI\n * surfaces.\n *\n * Four feeds, normalized into `CatalogEntry`:\n * - **Project sources** — `skaile.yaml` `sources:` entries (scanned via\n * `AssetManager.search()`; the new `sources:` field is merged into the\n * legacy repositories map in `AssetManager.loadConfig`).\n * - **Local libraries** — user authoring places from `LocalIndex` (filesystem\n * scan of each library's `path`).\n * - **Factory assets** — the bundled first-party `factory-assets` tree\n * (`factoryAssetRoots()`), scanned from disk. Always present; no network.\n * - **Remote store** — the configured catalog source when `catalog.url` is\n * not `local`. Failures are non-fatal — they surface as notes.\n */\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport {\n type AssetKind,\n type CatalogDomain,\n type CatalogEntry,\n factoryAssetRoots,\n parseFrontmatter,\n scanRepo,\n walkDir,\n} from \"@skaile/workspaces/core\";\nimport {\n assignDomain,\n buildDomainIndex,\n DOMAIN_MD_FILENAME,\n type DomainMd,\n parseDomainMd,\n} from \"@skaile/workspaces/discovery\";\n\n/** One non-fatal note returned to the caller for surfacing in the UI. */\nexport interface FeedNote {\n feed: \"sources\" | \"libraries\" | \"store\" | \"factory\";\n message: string;\n}\n\n/**\n * Which feed an asset came from. This is the top-level grouping axis in the\n * manage TUI (\"where is this skill coming from?\") and is intentionally distinct\n * from `publisher` (asset-intrinsic identity): the same publisher can legitimately\n * appear under more than one origin (e.g. a github repo you added as a `source`\n * that is also listed in the remote `store`).\n */\nexport type AssetOrigin = \"source\" | \"library\" | \"factory\" | \"store\";\n\n/** A catalog entry tagged with the feed it was gathered from. */\nexport interface OriginEntry {\n origin: AssetOrigin;\n entry: CatalogEntry;\n /**\n * Second-level grouping label for the manage tree. Defaults (when unset) to the\n * entry's `publisher`; the source feed sets it to the source's short repo name\n * so the Sources band groups by source — \"which repo did this come from\" — not\n * by the asset-intrinsic publisher.\n */\n group?: string;\n}\n\nexport interface AssetFeedResult {\n entries: OriginEntry[];\n /**\n * Display-only domain metadata, keyed (by the consumer) on `slug`. Populated\n * from the store's `catalog.listDomains` when the connected catalog source\n * exposes it; empty otherwise. The manage TUI joins `entry.domainSlug` → a\n * domain for grouping headers, descriptions, and relation badges.\n */\n domains: CatalogDomain[];\n notes: FeedNote[];\n}\n\n// ── Domain stamping (on-disk feeds) ──────────────────────────────────────────\n//\n// `scanRepo` (the source / library / factory scan path) does not read the\n// `DOMAIN.md` sidecars, so its entries arrive with no `domainSlug` and render\n// flat under their publisher band. We re-derive the grouping here from the\n// root's `DOMAIN.md` files (the same sidecars the remote store computes\n// server-side), and fall back to the repo/source name for any entry no domain\n// claims so it still groups instead of landing in the synthetic \"no domain\" pile.\n\n/** Repo-relative POSIX path (DOMAIN.md slugs are matched whole-segment, `/`-joined). */\nfunction toPosix(p: string): string {\n return p.split(path.sep).join(\"/\");\n}\n\n/** Parse every `DOMAIN.md` sidecar under `root` into a {@link DomainMd}. */\nfunction loadDomainMds(root: string): DomainMd[] {\n const out: DomainMd[] = [];\n for (const { path: filePath, name } of walkDir(root)) {\n if (name !== DOMAIN_MD_FILENAME) continue;\n try {\n const { data } = parseFrontmatter(readFileSync(filePath, \"utf8\"));\n out.push(parseDomainMd(toPosix(path.relative(root, filePath)), data));\n } catch {}\n }\n return out;\n}\n\n/**\n * Stamp `domainSlug` onto every entry scanned from `root` using the root's\n * `DOMAIN.md` sidecars. Returns the `CatalogDomain` registry for the real\n * domains, plus a synthetic fallback domain when any entry used the fallback.\n * Mutates `entries` in place (sets `entry.domainSlug`).\n *\n * `synthesizeFallback` (default true): entries no domain claims fall back to\n * `fallbackSlug` (the repo/source name). Pass `false` when the caller already\n * groups these entries one level up (e.g. the source feed groups by source\n * node) — unmatched entries then get no domain (`\"\"`) and hang directly under\n * that parent, instead of nesting under a same-named fallback domain.\n */\nfunction stampDomains(\n root: string,\n fallbackSlug: string,\n entries: CatalogEntry[],\n synthesizeFallback = true,\n): CatalogDomain[] {\n const domainMds = loadDomainMds(root);\n const assignables = entries.map((entry) => ({\n entry,\n ref: `${entry.kind}:${entry.name}`,\n relativePath: toPosix(path.relative(root, entry.source)),\n }));\n\n let usedFallback = false;\n for (const a of assignables) {\n const slug = assignDomain(a.relativePath, domainMds);\n if (slug) a.entry.domainSlug = slug;\n else if (synthesizeFallback) {\n a.entry.domainSlug = fallbackSlug;\n usedFallback = true;\n } else a.entry.domainSlug = \"\";\n }\n\n const { index } = buildDomainIndex(assignables, domainMds);\n const catalog: CatalogDomain[] = Object.values(index).map((d) => ({\n slug: d.slug,\n title: d.title,\n ...(d.description ? { description: d.description } : {}),\n ...(d.relation ? { relation: d.relation } : {}),\n ...(d.order !== undefined ? { order: d.order } : {}),\n ...(d.recommended[0] ? { recommendedRef: d.recommended[0] } : {}),\n }));\n if (usedFallback) catalog.push({ slug: fallbackSlug, title: fallbackSlug });\n return catalog;\n}\n\n/**\n * Pull assets from local libraries (the authoring places under\n * `~/.skaile/libraries/<name>/`, not the `~/.skaile/cache/sources/` cache). Each\n * library's `path` is scanned with `scanRepo` and grouped under the bare library\n * name (`group: <name>`) so the manage TUI shows a clean `<name>` band — no\n * `library:` prefix and no redundant same-named fallback domain (mirrors the\n * source feed).\n */\nasync function libraryAssets(): Promise<{\n entries: OriginEntry[];\n domains: CatalogDomain[];\n notes: FeedNote[];\n}> {\n const notes: FeedNote[] = [];\n const domains: CatalogDomain[] = [];\n try {\n const [{ openLibraryManager }, { skaileHomeDir }, { getGlobalCacheDir }] = await Promise.all([\n import(\"./open-library.ts\"),\n import(\"@skaile/workspaces/library\"),\n import(\"@skaile/workspaces/core\"),\n ]);\n const { manager, close } = await openLibraryManager();\n try {\n // Authoring libraries are the rows that are NOT source clones. index.db\n // rows predating the cache migration still carry the legacy\n // ~/.skaile/sources path, so exclude both roots.\n const newRoot = getGlobalCacheDir();\n const legacyRoot = path.join(skaileHomeDir(), \"sources\");\n const libs = (await manager.listLibraries()).filter(\n (l) => !l.path.startsWith(newRoot) && !l.path.startsWith(legacyRoot),\n );\n const entries: OriginEntry[] = [];\n for (const lib of libs) {\n if (!existsSync(lib.path)) continue;\n // Scan + group under the bare library name. `synthesizeFallback: false`\n // (as the source feed does) keeps domainless assets directly under the\n // library band instead of a redundant same-named fallback domain.\n const libEntries = [...scanRepo(lib.path, lib.name)];\n domains.push(...stampDomains(lib.path, lib.name, libEntries, false));\n for (const entry of libEntries) entries.push({ origin: \"library\", entry, group: lib.name });\n }\n return { entries, domains, notes };\n } finally {\n close();\n }\n } catch (err) {\n notes.push({\n feed: \"libraries\",\n message: err instanceof Error ? err.message : String(err),\n });\n return { entries: [], domains, notes };\n }\n}\n\n/**\n * Pull a (best-effort) snapshot of the connected remote store catalog.\n *\n * - Returns no entries when the resolved catalog is local-only or the host\n * is unreachable (the failure becomes a note, not an exception).\n * - Maps `CatalogAsset` → `CatalogEntry`, carrying `publisher`, `repo`, and\n * `category` straight through and using `source = \"store://<id>\"`; per-file\n * `source` paths are not available for remote assets so the canonical ref is\n * a stable placeholder.\n */\nasync function storeAssets(projectDir: string): Promise<{\n entries: CatalogEntry[];\n domains: CatalogDomain[];\n notes: FeedNote[];\n}> {\n const notes: FeedNote[] = [];\n try {\n const { resolveCatalogSource } = await import(\"./open-library.ts\");\n const { source, close } = await resolveCatalogSource({ projectDir });\n try {\n const assets = await source.listAssets();\n const entries: CatalogEntry[] = assets.map((a) => ({\n name: a.name,\n kind: (a.kind as AssetKind) ?? \"skill\",\n description: a.description ?? \"\",\n source: `store://${a.id}`,\n publisher: a.publisher,\n repo: a.repo,\n domainSlug: a.domainSlug,\n category: a.category,\n version: a.version,\n requires: [],\n dependencies: [],\n }));\n // Domains are optional on the catalog source — only the store backend\n // (post Part 4 `catalog.listDomains`) exposes them. Duck-type the call so\n // older sources and the local catalog degrade to no domains, not an error.\n const domains = await loadDomains(source);\n return { entries, domains, notes };\n } finally {\n close();\n }\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n // Local-only catalog throws a recognizable message — silence it; absence\n // is the user's choice, not an error.\n if (!/local/i.test(msg)) {\n notes.push({ feed: \"store\", message: msg });\n }\n return { entries: [], domains: [], notes };\n }\n}\n\n/** Optional `listDomains` capability — returns `[]` when the source lacks it. */\nasync function loadDomains(source: unknown): Promise<CatalogDomain[]> {\n const fn = (source as { listDomains?: () => Promise<CatalogDomain[]> }).listDomains;\n if (typeof fn !== \"function\") return [];\n const domains = await fn.call(source);\n return Array.isArray(domains) ? domains : [];\n}\n\n/** The slice of `AssetManager` the source feed needs (kept narrow for tests). */\ninterface AssetManagerLike {\n search: () => CatalogEntry[];\n searchRepoRoots: () => { repoName: string; root: string }[];\n}\n\n/**\n * Project-source feed: leans on `AssetManager.search()`, which now merges\n * `skaile.yaml`'s `sources:` field into the repositories map, then stamps\n * `DOMAIN.md`-derived domain grouping onto the scanned entries via\n * `searchRepoRoots()`.\n */\nfunction sourceAssets(am: AssetManagerLike): { entries: OriginEntry[]; domains: CatalogDomain[] } {\n // The bundled factory tree is injected into the repositories map as an implicit\n // source, so `am.search()` returns it too. It has its own `factory` origin band,\n // so drop it here — otherwise the same first-party skills list twice under Sources.\n const factoryPrefixes = factoryAssetRoots().map((r) => (r.endsWith(path.sep) ? r : r + path.sep));\n const isFactoryPath = (p: string) =>\n factoryPrefixes.some((fp) => p === fp.slice(0, -1) || p.startsWith(fp));\n\n const all = am.search().filter((e) => !isFactoryPath(e.source));\n const entries: OriginEntry[] = [];\n const domains: CatalogDomain[] = [];\n // Group each source's entries under the source node (its short repo name), not\n // the publisher: under Sources the navigational question is \"which repo did\n // this come from\". Each entry's `source` (absolute manifest path) lives under\n // exactly one declared root, so group + stamp by prefix. The cache slug is\n // URL-keyed `github.com/<org>/<repo>` — take the trailing segment.\n for (const { repoName, root } of am.searchRepoRoots()) {\n if (isFactoryPath(root)) continue;\n const prefix = root.endsWith(path.sep) ? root : root + path.sep;\n const owned = all.filter((e) => e.source === root || e.source.startsWith(prefix));\n if (owned.length === 0) continue;\n const sourceName = repoName.split(\"/\").pop() || repoName;\n // No synthetic fallback domain — the source node already groups these, so a\n // same-named fallback would just nest the source under itself.\n domains.push(...stampDomains(root, sourceName, owned, false));\n for (const entry of owned) entries.push({ origin: \"source\", entry, group: sourceName });\n }\n return { entries, domains };\n}\n\n/**\n * Factory-asset feed: scan the bundled first-party `factory-assets` tree(s)\n * resolved by `factoryAssetRoots()` (the `SKAILE_FACTORY_ASSETS_DIR` override\n * layer ahead of the bundled tree). Synchronous, no network — the entries are\n * the built-in skills / connectors / bundles that ship with `@skaile/workspaces`.\n * `factoryAssetRoots()` already dedupes, so the env override pointing at the\n * bundled dir collapses to one root.\n */\nfunction factoryAssets(): { entries: CatalogEntry[]; domains: CatalogDomain[]; notes: FeedNote[] } {\n const notes: FeedNote[] = [];\n const domains: CatalogDomain[] = [];\n try {\n const entries: CatalogEntry[] = [];\n for (const root of factoryAssetRoots()) {\n const rootEntries = [...scanRepo(root, \"skaile-factory\")];\n domains.push(...stampDomains(root, \"skaile-factory\", rootEntries));\n entries.push(...rootEntries);\n }\n return { entries, domains, notes };\n } catch (err) {\n notes.push({\n feed: \"factory\",\n message: err instanceof Error ? err.message : String(err),\n });\n return { entries: [], domains, notes };\n }\n}\n\n/** Tag a flat entry list with a single origin. */\nfunction tag(origin: AssetOrigin, entries: CatalogEntry[]): OriginEntry[] {\n return entries.map((entry) => ({ origin, entry }));\n}\n\n/**\n * Run all feeds and return a single normalized result.\n *\n * Feeds run in parallel where possible — the store fetch is the slow one\n * (one HTTP call) and is fired alongside the local library walk. The factory\n * scan is local + synchronous, so it runs inline.\n */\nexport async function gatherAssetFeeds(\n am: AssetManagerLike,\n projectDir: string,\n): Promise<AssetFeedResult> {\n const [libs, store] = await Promise.all([libraryAssets(), storeAssets(projectDir)]);\n const factory = factoryAssets();\n const src = sourceAssets(am);\n return {\n entries: [\n ...src.entries,\n ...libs.entries,\n ...tag(\"factory\", factory.entries),\n ...tag(\"store\", store.entries),\n ],\n // Store domains first (server-curated), then the on-disk feeds; dedupe by\n // slug, first-wins, so a store-served domain shadows a same-slug local one.\n domains: dedupeBySlug([...store.domains, ...src.domains, ...libs.domains, ...factory.domains]),\n notes: [...libs.notes, ...store.notes, ...factory.notes],\n };\n}\n\n/** First-wins dedupe of a domain list by `slug`. */\nfunction dedupeBySlug(domains: CatalogDomain[]): CatalogDomain[] {\n const seen = new Set<string>();\n const out: CatalogDomain[] = [];\n for (const d of domains) {\n if (seen.has(d.slug)) continue;\n seen.add(d.slug);\n out.push(d);\n }\n return out;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AssetManager, FACTORY_SOURCE_URL, MissingManifestError, NON_DEPLOYABLE_KINDS, normalizeRepoUrl, parseCanonicalLockKey, parseRefTolerant, softDepName } from '../chunk-
|
|
1
|
+
export { AssetManager, FACTORY_SOURCE_URL, MissingManifestError, NON_DEPLOYABLE_KINDS, normalizeRepoUrl, parseCanonicalLockKey, parseRefTolerant, softDepName } from '../chunk-QRHQY4IG.js';
|
|
2
2
|
import '../chunk-MWE7DEGC.js';
|
|
3
3
|
import '../chunk-MZV6WCF3.js';
|
|
4
4
|
import '../chunk-JXT46QFC.js';
|
|
@@ -303,5 +303,5 @@ function resolveProjectDir(additionalEnvVars) {
|
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
export { PluginStore, WorkspacePlugin, buildClaudePluginFiles, resolveProjectDir };
|
|
306
|
-
//# sourceMappingURL=chunk-
|
|
307
|
-
//# sourceMappingURL=chunk-
|
|
306
|
+
//# sourceMappingURL=chunk-2QKVA5Y6.js.map
|
|
307
|
+
//# sourceMappingURL=chunk-2QKVA5Y6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../workspace-plugin/src/adapters/claude-code.ts","../workspace-plugin/src/store.ts","../workspace-plugin/src/plugin.ts","../workspace-plugin/src/utils/project-dir.ts"],"names":["err"],"mappings":";;;;;;AAeA,IAAM,WAAA,GAAc;AAAA,EAClB,IAAA,EAAM,QAAA;AAAA,EACN,OAAA,EAAS,OAAA;AAAA,EACT,WAAA,EAAa,yEAAA;AAAA,EACb,MAAA,EAAQ,EAAE,IAAA,EAAM,WAAA,EAAa,KAAK,8BAAA,EAA+B;AAAA,EACjE,UAAA,EAAY,yCAAA;AAAA,EACZ,QAAA,EAAU,CAAC,QAAA,EAAU,YAAA,EAAc,aAAa,WAAW,CAAA;AAAA,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AAI,KAAK,OAAO,GAAA;AAAA,EAClB;AACA,EAAA,OAAO,QAAQ,GAAA,EAAI;AACrB","file":"chunk-2ZP6KIIQ.js","sourcesContent":["// ── Claude Code plugin-directory generator (STATELESS) ──────────────────────\n// Generates the contents of a Claude Code plugin directory\n// (`.claude/plugins/skaile/`) as an in-memory file map. No plugin instance or\n// boot() is required — safe to call from install commands.\n//\n// The previous standalone `@skaile/workspace-plugin-claude` package shipped\n// these as static files plus loose `.mjs` hook scripts; they are now\n// CLI-owned templates. Hooks invoke the `skaile` binary directly\n// (`skaile plugin hook <event>`) and MCP runs via `skaile mcp-server` — no\n// generated script files, no shebang, no runtime assumption.\n\n/**\n * The Claude Code plugin manifest. `name` is `skaile`; `hooks` and\n * `mcpServers` point at sibling files in the generated directory.\n */\nconst PLUGIN_JSON = {\n name: \"skaile\",\n version: \"0.1.0\",\n description: \"Skaile workspace — connectors, mounts, skills, flows, shared state\",\n author: { name: \"skaile-ai\", url: \"https://github.com/skaile-ai\" },\n repository: \"https://github.com/skaile-ai/workspaces\",\n keywords: [\"skaile\", \"connectors\", \"workspace\", \"ai-assets\"],\n hooks: \"./hooks/hooks.json\",\n mcpServers: \"./.mcp.json\",\n userConfig: {\n skaile_yaml_path: {\n type: \"string\",\n title: \"skaile.yaml path\",\n description: \"Override path to skaile.yaml (default: auto-detect from project root)\",\n },\n },\n};\n\n/**\n * Hook wiring. Each lifecycle event invokes the `skaile` binary directly —\n * no loose `.mjs` scripts. `skaile plugin hook <event>` resolves the project\n * directory itself (`CLAUDE_PROJECT_DIR` / cwd) and always exits 0.\n */\nconst HOOKS_JSON = {\n hooks: {\n SessionStart: [{ hooks: [{ type: \"command\", command: \"skaile plugin hook session-start\" }] }],\n SessionEnd: [{ hooks: [{ type: \"command\", command: \"skaile plugin hook session-end\" }] }],\n UserPromptSubmit: [\n { hooks: [{ type: \"command\", command: \"skaile plugin hook user-prompt-submit\" }] },\n ],\n },\n};\n\n/**\n * MCP server wiring. Spawns `skaile mcp-server` — a stdio MCP subprocess that\n * runs on plain Node (no Claude Agent SDK).\n */\nconst MCP_JSON = {\n mcpServers: {\n \"skaile-workspace\": {\n command: \"skaile\",\n args: [\"mcp-server\"],\n env: {},\n },\n },\n};\n\n/**\n * Build the Claude Code plugin directory as an in-memory file map.\n *\n * Returns `{ relativePath: contents }` for every file the installer must\n * write under `<projectDir>/.claude/plugins/skaile/`. The installer is also\n * responsible for populating `skills/` from the project's `.skaile/skills/`.\n *\n * Stateless — no plugin instance, no `boot()`. The generated artifacts carry\n * no project-specific paths: hooks and the MCP server resolve the project\n * directory themselves at runtime.\n *\n * @returns A map of plugin-relative file paths to their string contents.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport function buildClaudePluginFiles(): Record<string, string> {\n return {\n \".claude-plugin/plugin.json\": `${JSON.stringify(PLUGIN_JSON, null, 2)}\\n`,\n \"hooks/hooks.json\": `${JSON.stringify(HOOKS_JSON, null, 2)}\\n`,\n \".mcp.json\": `${JSON.stringify(MCP_JSON, null, 2)}\\n`,\n \"skills/.gitkeep\": \"\",\n };\n}\n","import { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\n\ninterface Subscriber {\n regex: RegExp;\n handler: (key: string, value: unknown) => void;\n}\n\n/**\n * Disk-backed reactive key-value store for plugin state.\n *\n * Keeps an in-memory map that can be flushed to / loaded from a JSON file.\n * Supports glob-style subscriptions (`connector:*`, `*`).\n *\n * State is persisted to `<projectDir>/.skaile/plugin-state.json`.\n * The instance is available on {@link WorkspacePlugin} as the public `store`\n * field after `boot()` resolves.\n *\n * @docLink packages/workspace-plugin/concepts#plugin-store\n */\nexport class PluginStore {\n private readonly statePath: string;\n private data: Map<string, unknown> = new Map();\n private subscribers: Subscriber[] = [];\n\n constructor(statePath: string) {\n this.statePath = statePath;\n }\n\n /** Synchronous read from in-memory map. */\n get<T>(key: string): T | undefined {\n return this.data.get(key) as T | undefined;\n }\n\n /** Write to in-memory map and notify matching subscribers. */\n set<T>(key: string, value: T): void {\n this.data.set(key, value);\n this.notify(key, value);\n }\n\n /** Remove key and notify matching subscribers. */\n delete(key: string): void {\n this.data.delete(key);\n this.notify(key, undefined);\n }\n\n /**\n * Subscribe to changes matching a glob-style pattern.\n * `*` matches any sequence of characters.\n * Returns an unsubscribe function.\n */\n subscribe(pattern: string, handler: (key: string, value: unknown) => void): () => void {\n const escaped = pattern.replace(/[.+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const regexStr = `^${escaped.replace(/\\*/g, \".*\")}$`;\n const sub: Subscriber = { regex: new RegExp(regexStr), handler };\n this.subscribers.push(sub);\n\n return () => {\n const idx = this.subscribers.indexOf(sub);\n if (idx !== -1) this.subscribers.splice(idx, 1);\n };\n }\n\n /** Rehydrate from disk JSON. Missing file = empty store (no throw). */\n async load(): Promise<void> {\n try {\n const raw = await readFile(this.statePath, \"utf-8\");\n const parsed = JSON.parse(raw);\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n this.data = new Map(Object.entries(parsed));\n }\n } catch (e: unknown) {\n // Missing file or invalid JSON — start with empty store\n }\n }\n\n /** Write entire store to disk as JSON. Creates parent dirs if needed. */\n async flush(): Promise<void> {\n const obj = Object.fromEntries(this.data);\n const json = JSON.stringify(obj, null, 2);\n await mkdir(dirname(this.statePath), { recursive: true });\n await writeFile(this.statePath, json, \"utf-8\");\n }\n\n private notify(key: string, value: unknown): void {\n for (const sub of this.subscribers) {\n if (sub.regex.test(key)) {\n sub.handler(key, value);\n }\n }\n }\n}\n","import { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { ConnectorManager } from \"@skaile/workspaces/connectors\";\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\nimport type { Logger } from \"@skaile/workspaces/types\";\nimport { PluginStore } from \"./store.js\";\n\n/**\n * Construction options for {@link WorkspacePlugin}.\n *\n * At minimum `projectDir` must be supplied. All other fields are optional\n * and are pre-resolved by the caller when available (e.g. the runner already\n * knows `driver`/`provider`/`model` from its own settings resolution).\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport interface WorkspacePluginOpts {\n projectDir: string;\n /**\n * Active connector manager. The unified `ConnectorManager` owns both\n * filesystem-face (mountable) and tool-face connectors.\n */\n connectorManager?: ConnectorManager;\n bootOwned?: boolean;\n onLog?: (msg: string) => void;\n /** Pre-resolved driver type (avoids needing boot() to read settings). */\n driver?: string;\n /** Pre-resolved provider. */\n provider?: string;\n /** Pre-resolved model. */\n model?: string;\n}\n\n/**\n * Shared runtime core for the skaile workspace plugin.\n *\n * Manages the full lifecycle (`boot` → tools available → `shutdown`) and\n * surfaces workspace capabilities — mounts, connectors, flows, skills,\n * sessions, and config validation — through two adapter backends:\n *\n * - **MCP, in-process** (runner): call {@link buildWorkspaceMcpServer} for the\n * Claude Agent SDK server the runner embeds into its `query()` call.\n * - **MCP, stdio** (`skaile mcp-server`): call {@link runMcpServerStdio} for a\n * raw `@modelcontextprotocol/sdk` server — no Claude Agent SDK.\n * - **OMP**: call {@link buildOmpToolSet} for the 13-tool native subset and\n * {@link buildOmpExtensionSource} for the generated extension file.\n *\n * Two boot modes are supported via {@link WorkspacePluginOpts.bootOwned}:\n * - `bootOwned: false` (default) — managers injected externally by the runner.\n * - `bootOwned: true` — plugin owns the full manager lifecycle (standalone MCP\n * subprocess or OMP extension).\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport class WorkspacePlugin {\n readonly projectDir: string;\n connectorManager: ConnectorManager | null;\n readonly store: PluginStore;\n\n private readonly bootOwned: boolean;\n private readonly onLog: (msg: string) => void;\n private readonly log: Logger = createLogger({\n kind: \"mcp\",\n subkind: \"skaile-workspace\",\n });\n driver?: string;\n provider?: string;\n model?: string;\n\n constructor(opts: WorkspacePluginOpts) {\n this.projectDir = opts.projectDir;\n this.connectorManager = opts.connectorManager ?? null;\n this.store = new PluginStore(join(opts.projectDir, \".skaile\", \"plugin-state.json\"));\n this.bootOwned = opts.bootOwned ?? false;\n if (opts.driver) this.driver = opts.driver;\n if (opts.provider) this.provider = opts.provider;\n if (opts.model) this.model = opts.model;\n this.onLog = opts.onLog ?? (() => {});\n this.log.debug(\"plugin constructed\", {\n driver: opts.driver,\n hasConnectors: !!opts.connectorManager,\n provider: opts.provider,\n model: opts.model,\n bootOwned: this.bootOwned,\n });\n }\n\n async boot(): Promise<void> {\n if (!this.bootOwned) {\n // Managers were injected externally — resolve settings only (non-fatal)\n try {\n const { resolveSettings } = await import(\"@skaile/workspaces/core\");\n const settings = await resolveSettings(this.projectDir);\n this.driver = settings.driver ?? \"omp\";\n this.provider = settings.provider;\n this.model = settings.model;\n } catch {\n /* non-fatal */\n }\n await this.store.load();\n return;\n }\n\n // bootOwned: we own the managers lifecycle\n try {\n const { resolveSettings } = await import(\"@skaile/workspaces/core\");\n const settings = await resolveSettings(this.projectDir);\n this.driver = settings.driver ?? \"omp\";\n this.provider = settings.provider;\n this.model = settings.model;\n } catch {\n /* non-fatal */\n }\n\n try {\n const {\n ConnectorManager,\n loadConnectorDeclarations,\n registerBuiltinConnectors,\n createCliSecretProviderChain,\n } = await import(\"@skaile/workspaces/connectors\");\n\n registerBuiltinConnectors();\n\n const secrets = createCliSecretProviderChain();\n\n const connectorDecls = await loadConnectorDeclarations(this.projectDir);\n const cm = new ConnectorManager(this.projectDir, { secrets });\n await cm.connectAll(connectorDecls);\n this.connectorManager = cm;\n\n this.log.info(\"workspace plugin booted\", {\n connectors: connectorDecls.length,\n });\n this.onLog(`WorkspacePlugin booted: ${connectorDecls.length} connectors`);\n } catch (err) {\n this.log.warn(\"workspace plugin boot warning\", {\n error: err instanceof Error ? err.message : String(err),\n });\n this.onLog(`WorkspacePlugin boot warning: ${err}`);\n }\n\n await this.store.load();\n }\n\n async reload(): Promise<void> {\n if (!this.bootOwned) return;\n await this.shutdown();\n await this.boot();\n }\n\n async shutdown(): Promise<void> {\n this.log.info(\"workspace plugin shutdown\");\n await this.store.flush();\n if (!this.bootOwned) return;\n try {\n await (this.connectorManager as any)?.disconnectAll?.();\n } catch {\n /* best-effort */\n }\n this.connectorManager = null;\n }\n\n buildSystemPromptSection(driver?: string): string {\n const d = driver ?? this.driver ?? \"unknown\";\n // The unified ConnectorManager owns both mountable (filesystem-face) and\n // tool-face connectors. Filesystem-face connectors expose a `mountPath`.\n const all = (this.connectorManager as any)?.listConnectors?.() ?? [];\n const mounts = (all as any[]).filter((c) => typeof c.mountPath === \"string\");\n const connectors = (all as any[]).filter((c) => typeof c.mountPath !== \"string\");\n const lines = [\"## Workspace (skaile)\", \"\", `Driver: ${d}`, `Project: ${this.projectDir}`];\n if (mounts.length > 0) {\n lines.push(\"\", \"Mounts:\");\n for (const v of mounts) {\n lines.push(` · ${v.id} (${v.driver}) → ${v.mountPath ?? \"(unmounted)\"}`);\n }\n }\n if (connectors.length > 0) {\n lines.push(\"\", \"Connectors:\");\n for (const c of connectors) {\n lines.push(` · ${c.id} (${c.driver})`);\n }\n }\n lines.push(\"\", \"Use workspace_info for full details. Use workspace_validate to check health.\");\n\n for (const name of [\"SOUL.md\", \"RULES.md\"]) {\n const skaileOverride = join(this.projectDir, \".skaile\", name);\n const rootFile = join(this.projectDir, name);\n for (const candidate of [skaileOverride, rootFile]) {\n try {\n const content = readFileSync(candidate, \"utf-8\").trim();\n if (content) {\n lines.push(\"\", `## ${name.replace(\".md\", \"\")}`, \"\", content);\n break;\n }\n } catch {\n // file not found, try next\n }\n }\n }\n\n return lines.join(\"\\n\");\n }\n\n /**\n * Build the in-process Claude Agent SDK MCP server (runner embedding).\n * Returns `null` when `@anthropic-ai/claude-agent-sdk` is unavailable.\n */\n async buildWorkspaceMcpServer(): Promise<unknown | null> {\n this.log.info(\"building workspace MCP server\");\n try {\n const { buildWorkspaceMcpServer } = await import(\"./adapters/mcp.js\");\n const server = await buildWorkspaceMcpServer(this);\n if (server) this.log.info(\"workspace MCP server ready\");\n else this.log.debug(\"workspace MCP server skipped (no tools)\");\n return server;\n } catch (err) {\n this.log.error(\"workspace MCP server build failed\", err);\n throw err;\n }\n }\n\n /**\n * Build the raw `@modelcontextprotocol/sdk` stdio MCP server — no Claude\n * Agent SDK. Used by the `skaile mcp-server` subprocess. The returned\n * server is not yet connected to a transport.\n */\n async buildWorkspaceMcpStdioServer(): Promise<unknown> {\n this.log.info(\"building workspace stdio MCP server\");\n const { buildWorkspaceMcpStdioServer } = await import(\"./adapters/mcp.js\");\n return buildWorkspaceMcpStdioServer(this);\n }\n\n /**\n * Build and run the stdio MCP server: builds the raw\n * `@modelcontextprotocol/sdk` server and connects a `StdioServerTransport`.\n * Used by the `skaile mcp-server` subprocess.\n */\n async runMcpServerStdio(): Promise<void> {\n this.log.info(\"starting workspace stdio MCP server\");\n const { runMcpServerStdio } = await import(\"./adapters/mcp.js\");\n await runMcpServerStdio(this);\n }\n\n async buildOmpToolSet(): Promise<unknown[]> {\n const { buildOmpToolSet } = await import(\"./adapters/omp.js\");\n return buildOmpToolSet(this);\n }\n\n async buildOmpExtensionSource(): Promise<string> {\n const { buildOmpExtensionSource } = await import(\"./adapters/omp.js\");\n return buildOmpExtensionSource(this.projectDir);\n }\n\n async handleSlashCommand(group: string, args: string[]): Promise<string> {\n const { handleSlashCommand } = await import(\"./adapters/omp.js\");\n return handleSlashCommand(this, group, args);\n }\n}\n","// utils/project-dir.ts\n// Centralised project-directory resolution used by all plugin entry points.\n\n/**\n * Resolve the skaile project directory from environment variables.\n *\n * Resolution order:\n * 1. `SKAILE_PROJECT_DIR` (always checked first)\n * 2. Any additional env var keys supplied by the caller (in order)\n * 3. `process.cwd()` as final fallback\n *\n * @param additionalEnvVars - Optional list of extra environment variable names\n * to check before falling back to `process.cwd()`.\n * @returns Absolute path to the resolved project directory.\n *\n * @example\n * // Claude Code — also checks CLAUDE_PROJECT_DIR\n * const projectDir = resolveProjectDir([\"CLAUDE_PROJECT_DIR\"]);\n *\n * // OMP / standalone — SKAILE_PROJECT_DIR or cwd only\n * const projectDir = resolveProjectDir();\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport function resolveProjectDir(additionalEnvVars?: string[]): string {\n if (process.env.SKAILE_PROJECT_DIR) return process.env.SKAILE_PROJECT_DIR;\n for (const key of additionalEnvVars ?? []) {\n const val = process.env[key];\n if (val) return val;\n }\n return process.cwd();\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../workspace-plugin/src/adapters/claude-code.ts","../workspace-plugin/src/store.ts","../workspace-plugin/src/plugin.ts","../workspace-plugin/src/utils/project-dir.ts"],"names":["err"],"mappings":";;;;;;AAeA,IAAM,WAAA,GAAc;AAAA,EAClB,IAAA,EAAM,QAAA;AAAA,EACN,OAAA,EAAS,OAAA;AAAA,EACT,WAAA,EAAa,yEAAA;AAAA,EACb,MAAA,EAAQ,EAAE,IAAA,EAAM,WAAA,EAAa,KAAK,8BAAA,EAA+B;AAAA,EACjE,UAAA,EAAY,yCAAA;AAAA,EACZ,QAAA,EAAU,CAAC,QAAA,EAAU,YAAA,EAAc,aAAa,WAAW,CAAA;AAAA,EAC3D,KAAA,EAAO,oBAAA;AAAA,EACP,UAAA,EAAY,aAAA;AAAA,EACZ,UAAA,EAAY;AAAA,IACV,gBAAA,EAAkB;AAAA,MAChB,IAAA,EAAM,QAAA;AAAA,MACN,KAAA,EAAO,kBAAA;AAAA,MACP,WAAA,EAAa;AAAA;AACf;AAEJ,CAAA;AAOA,IAAM,UAAA,GAAa;AAAA,EACjB,KAAA,EAAO;AAAA,IACL,YAAA,EAAc,CAAC,EAAE,KAAA,EAAO,CAAC,EAAE,IAAA,EAAM,SAAA,EAAW,OAAA,EAAS,kCAAA,EAAoC,CAAA,EAAG,CAAA;AAAA,IAC5F,UAAA,EAAY,CAAC,EAAE,KAAA,EAAO,CAAC,EAAE,IAAA,EAAM,SAAA,EAAW,OAAA,EAAS,gCAAA,EAAkC,CAAA,EAAG,CAAA;AAAA,IACxF,gBAAA,EAAkB;AAAA,MAChB,EAAE,OAAO,CAAC,EAAE,MAAM,SAAA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M,uBAAA,GAA2C;AAC/C,IAAA,MAAM,EAAE,uBAAA,EAAwB,GAAI,MAAM,OAAO,oCAAmB,CAAA;AACpE,IAAA,OAAO,uBAAA,CAAwB,KAAK,UAAU,CAAA;AAAA,EAChD;AAAA,EAEA,MAAM,kBAAA,CAAmB,KAAA,EAAe,IAAA,EAAiC;AACvE,IAAA,MAAM,EAAE,kBAAA,EAAmB,GAAI,MAAM,OAAO,oCAAmB,CAAA;AAC/D,IAAA,OAAO,kBAAA,CAAmB,IAAA,EAAM,KAAA,EAAO,IAAI,CAAA;AAAA,EAC7C;AACF;;;AC1OO,SAAS,kBAAkB,iBAAA,EAAsC;AACtE,EAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,kBAAA,EAAoB,OAAO,QAAQ,GAAA,CAAI,kBAAA;AACvD,EAAA,KAAA,MAAW,GAAA,IAAO,iBAAA,IAAqB,EAAC,EAAG;AACzC,IAAA,MAAM,GAAA,GAAM,OAAA,CAAQ,GAAA,CAAI,GAAG,CAAA;AAC3B,IAAA,IAAI,KAAK,OAAO,GAAA;AAAA,EAClB;AACA,EAAA,OAAO,QAAQ,GAAA,EAAI;AACrB","file":"chunk-2QKVA5Y6.js","sourcesContent":["// ── Claude Code plugin-directory generator (STATELESS) ──────────────────────\n// Generates the contents of a Claude Code plugin directory\n// (`.claude/plugins/skaile/`) as an in-memory file map. No plugin instance or\n// boot() is required — safe to call from install commands.\n//\n// The previous standalone `@skaile/workspace-plugin-claude` package shipped\n// these as static files plus loose `.mjs` hook scripts; they are now\n// CLI-owned templates. Hooks invoke the `skaile` binary directly\n// (`skaile plugin hook <event>`) and MCP runs via `skaile mcp-server` — no\n// generated script files, no shebang, no runtime assumption.\n\n/**\n * The Claude Code plugin manifest. `name` is `skaile`; `hooks` and\n * `mcpServers` point at sibling files in the generated directory.\n */\nconst PLUGIN_JSON = {\n name: \"skaile\",\n version: \"0.1.0\",\n description: \"Skaile workspace — connectors, mounts, skills, flows, shared state\",\n author: { name: \"skaile-ai\", url: \"https://github.com/skaile-ai\" },\n repository: \"https://github.com/skaile-ai/workspaces\",\n keywords: [\"skaile\", \"connectors\", \"workspace\", \"ai-assets\"],\n hooks: \"./hooks/hooks.json\",\n mcpServers: \"./.mcp.json\",\n userConfig: {\n skaile_yaml_path: {\n type: \"string\",\n title: \"skaile.yaml path\",\n description: \"Override path to skaile.yaml (default: auto-detect from project root)\",\n },\n },\n};\n\n/**\n * Hook wiring. Each lifecycle event invokes the `skaile` binary directly —\n * no loose `.mjs` scripts. `skaile plugin hook <event>` resolves the project\n * directory itself (`CLAUDE_PROJECT_DIR` / cwd) and always exits 0.\n */\nconst HOOKS_JSON = {\n hooks: {\n SessionStart: [{ hooks: [{ type: \"command\", command: \"skaile plugin hook session-start\" }] }],\n SessionEnd: [{ hooks: [{ type: \"command\", command: \"skaile plugin hook session-end\" }] }],\n UserPromptSubmit: [\n { hooks: [{ type: \"command\", command: \"skaile plugin hook user-prompt-submit\" }] },\n ],\n },\n};\n\n/**\n * MCP server wiring. Spawns `skaile mcp-server` — a stdio MCP subprocess that\n * runs on plain Node (no Claude Agent SDK).\n */\nconst MCP_JSON = {\n mcpServers: {\n \"skaile-workspace\": {\n command: \"skaile\",\n args: [\"mcp-server\"],\n env: {},\n },\n },\n};\n\n/**\n * Build the Claude Code plugin directory as an in-memory file map.\n *\n * Returns `{ relativePath: contents }` for every file the installer must\n * write under `<projectDir>/.claude/plugins/skaile/`. The installer is also\n * responsible for populating `skills/` from the project's `.skaile/skills/`.\n *\n * Stateless — no plugin instance, no `boot()`. The generated artifacts carry\n * no project-specific paths: hooks and the MCP server resolve the project\n * directory themselves at runtime.\n *\n * @returns A map of plugin-relative file paths to their string contents.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport function buildClaudePluginFiles(): Record<string, string> {\n return {\n \".claude-plugin/plugin.json\": `${JSON.stringify(PLUGIN_JSON, null, 2)}\\n`,\n \"hooks/hooks.json\": `${JSON.stringify(HOOKS_JSON, null, 2)}\\n`,\n \".mcp.json\": `${JSON.stringify(MCP_JSON, null, 2)}\\n`,\n \"skills/.gitkeep\": \"\",\n };\n}\n","import { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\n\ninterface Subscriber {\n regex: RegExp;\n handler: (key: string, value: unknown) => void;\n}\n\n/**\n * Disk-backed reactive key-value store for plugin state.\n *\n * Keeps an in-memory map that can be flushed to / loaded from a JSON file.\n * Supports glob-style subscriptions (`connector:*`, `*`).\n *\n * State is persisted to `<projectDir>/.skaile/plugin-state.json`.\n * The instance is available on {@link WorkspacePlugin} as the public `store`\n * field after `boot()` resolves.\n *\n * @docLink packages/workspace-plugin/concepts#plugin-store\n */\nexport class PluginStore {\n private readonly statePath: string;\n private data: Map<string, unknown> = new Map();\n private subscribers: Subscriber[] = [];\n\n constructor(statePath: string) {\n this.statePath = statePath;\n }\n\n /** Synchronous read from in-memory map. */\n get<T>(key: string): T | undefined {\n return this.data.get(key) as T | undefined;\n }\n\n /** Write to in-memory map and notify matching subscribers. */\n set<T>(key: string, value: T): void {\n this.data.set(key, value);\n this.notify(key, value);\n }\n\n /** Remove key and notify matching subscribers. */\n delete(key: string): void {\n this.data.delete(key);\n this.notify(key, undefined);\n }\n\n /**\n * Subscribe to changes matching a glob-style pattern.\n * `*` matches any sequence of characters.\n * Returns an unsubscribe function.\n */\n subscribe(pattern: string, handler: (key: string, value: unknown) => void): () => void {\n const escaped = pattern.replace(/[.+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const regexStr = `^${escaped.replace(/\\*/g, \".*\")}$`;\n const sub: Subscriber = { regex: new RegExp(regexStr), handler };\n this.subscribers.push(sub);\n\n return () => {\n const idx = this.subscribers.indexOf(sub);\n if (idx !== -1) this.subscribers.splice(idx, 1);\n };\n }\n\n /** Rehydrate from disk JSON. Missing file = empty store (no throw). */\n async load(): Promise<void> {\n try {\n const raw = await readFile(this.statePath, \"utf-8\");\n const parsed = JSON.parse(raw);\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n this.data = new Map(Object.entries(parsed));\n }\n } catch (e: unknown) {\n // Missing file or invalid JSON — start with empty store\n }\n }\n\n /** Write entire store to disk as JSON. Creates parent dirs if needed. */\n async flush(): Promise<void> {\n const obj = Object.fromEntries(this.data);\n const json = JSON.stringify(obj, null, 2);\n await mkdir(dirname(this.statePath), { recursive: true });\n await writeFile(this.statePath, json, \"utf-8\");\n }\n\n private notify(key: string, value: unknown): void {\n for (const sub of this.subscribers) {\n if (sub.regex.test(key)) {\n sub.handler(key, value);\n }\n }\n }\n}\n","import { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { ConnectorManager } from \"@skaile/workspaces/connectors\";\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\nimport type { Logger } from \"@skaile/workspaces/types\";\nimport { PluginStore } from \"./store.js\";\n\n/**\n * Construction options for {@link WorkspacePlugin}.\n *\n * At minimum `projectDir` must be supplied. All other fields are optional\n * and are pre-resolved by the caller when available (e.g. the runner already\n * knows `driver`/`provider`/`model` from its own settings resolution).\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport interface WorkspacePluginOpts {\n projectDir: string;\n /**\n * Active connector manager. The unified `ConnectorManager` owns both\n * filesystem-face (mountable) and tool-face connectors.\n */\n connectorManager?: ConnectorManager;\n bootOwned?: boolean;\n onLog?: (msg: string) => void;\n /** Pre-resolved driver type (avoids needing boot() to read settings). */\n driver?: string;\n /** Pre-resolved provider. */\n provider?: string;\n /** Pre-resolved model. */\n model?: string;\n}\n\n/**\n * Shared runtime core for the skaile workspace plugin.\n *\n * Manages the full lifecycle (`boot` → tools available → `shutdown`) and\n * surfaces workspace capabilities — mounts, connectors, flows, skills,\n * sessions, and config validation — through two adapter backends:\n *\n * - **MCP, in-process** (runner): call {@link buildWorkspaceMcpServer} for the\n * Claude Agent SDK server the runner embeds into its `query()` call.\n * - **MCP, stdio** (`skaile mcp-server`): call {@link runMcpServerStdio} for a\n * raw `@modelcontextprotocol/sdk` server — no Claude Agent SDK.\n * - **OMP**: call {@link buildOmpToolSet} for the 13-tool native subset and\n * {@link buildOmpExtensionSource} for the generated extension file.\n *\n * Two boot modes are supported via {@link WorkspacePluginOpts.bootOwned}:\n * - `bootOwned: false` (default) — managers injected externally by the runner.\n * - `bootOwned: true` — plugin owns the full manager lifecycle (standalone MCP\n * subprocess or OMP extension).\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport class WorkspacePlugin {\n readonly projectDir: string;\n connectorManager: ConnectorManager | null;\n readonly store: PluginStore;\n\n private readonly bootOwned: boolean;\n private readonly onLog: (msg: string) => void;\n private readonly log: Logger = createLogger({\n kind: \"mcp\",\n subkind: \"skaile-workspace\",\n });\n driver?: string;\n provider?: string;\n model?: string;\n\n constructor(opts: WorkspacePluginOpts) {\n this.projectDir = opts.projectDir;\n this.connectorManager = opts.connectorManager ?? null;\n this.store = new PluginStore(join(opts.projectDir, \".skaile\", \"plugin-state.json\"));\n this.bootOwned = opts.bootOwned ?? false;\n if (opts.driver) this.driver = opts.driver;\n if (opts.provider) this.provider = opts.provider;\n if (opts.model) this.model = opts.model;\n this.onLog = opts.onLog ?? (() => {});\n this.log.debug(\"plugin constructed\", {\n driver: opts.driver,\n hasConnectors: !!opts.connectorManager,\n provider: opts.provider,\n model: opts.model,\n bootOwned: this.bootOwned,\n });\n }\n\n async boot(): Promise<void> {\n if (!this.bootOwned) {\n // Managers were injected externally — resolve settings only (non-fatal)\n try {\n const { resolveSettings } = await import(\"@skaile/workspaces/core\");\n const settings = await resolveSettings(this.projectDir);\n this.driver = settings.driver ?? \"omp\";\n this.provider = settings.provider;\n this.model = settings.model;\n } catch {\n /* non-fatal */\n }\n await this.store.load();\n return;\n }\n\n // bootOwned: we own the managers lifecycle\n try {\n const { resolveSettings } = await import(\"@skaile/workspaces/core\");\n const settings = await resolveSettings(this.projectDir);\n this.driver = settings.driver ?? \"omp\";\n this.provider = settings.provider;\n this.model = settings.model;\n } catch {\n /* non-fatal */\n }\n\n try {\n const {\n ConnectorManager,\n loadConnectorDeclarations,\n registerBuiltinConnectors,\n createCliSecretProviderChain,\n } = await import(\"@skaile/workspaces/connectors\");\n\n registerBuiltinConnectors();\n\n const secrets = createCliSecretProviderChain();\n\n const connectorDecls = await loadConnectorDeclarations(this.projectDir);\n const cm = new ConnectorManager(this.projectDir, { secrets });\n await cm.connectAll(connectorDecls);\n this.connectorManager = cm;\n\n this.log.info(\"workspace plugin booted\", {\n connectors: connectorDecls.length,\n });\n this.onLog(`WorkspacePlugin booted: ${connectorDecls.length} connectors`);\n } catch (err) {\n this.log.warn(\"workspace plugin boot warning\", {\n error: err instanceof Error ? err.message : String(err),\n });\n this.onLog(`WorkspacePlugin boot warning: ${err}`);\n }\n\n await this.store.load();\n }\n\n async reload(): Promise<void> {\n if (!this.bootOwned) return;\n await this.shutdown();\n await this.boot();\n }\n\n async shutdown(): Promise<void> {\n this.log.info(\"workspace plugin shutdown\");\n await this.store.flush();\n if (!this.bootOwned) return;\n try {\n await (this.connectorManager as any)?.disconnectAll?.();\n } catch {\n /* best-effort */\n }\n this.connectorManager = null;\n }\n\n buildSystemPromptSection(driver?: string): string {\n const d = driver ?? this.driver ?? \"unknown\";\n // The unified ConnectorManager owns both mountable (filesystem-face) and\n // tool-face connectors. Filesystem-face connectors expose a `mountPath`.\n const all = (this.connectorManager as any)?.listConnectors?.() ?? [];\n const mounts = (all as any[]).filter((c) => typeof c.mountPath === \"string\");\n const connectors = (all as any[]).filter((c) => typeof c.mountPath !== \"string\");\n const lines = [\"## Workspace (skaile)\", \"\", `Driver: ${d}`, `Project: ${this.projectDir}`];\n if (mounts.length > 0) {\n lines.push(\"\", \"Mounts:\");\n for (const v of mounts) {\n lines.push(` · ${v.id} (${v.driver}) → ${v.mountPath ?? \"(unmounted)\"}`);\n }\n }\n if (connectors.length > 0) {\n lines.push(\"\", \"Connectors:\");\n for (const c of connectors) {\n lines.push(` · ${c.id} (${c.driver})`);\n }\n }\n lines.push(\"\", \"Use workspace_info for full details. Use workspace_validate to check health.\");\n\n for (const name of [\"SOUL.md\", \"RULES.md\"]) {\n const skaileOverride = join(this.projectDir, \".skaile\", name);\n const rootFile = join(this.projectDir, name);\n for (const candidate of [skaileOverride, rootFile]) {\n try {\n const content = readFileSync(candidate, \"utf-8\").trim();\n if (content) {\n lines.push(\"\", `## ${name.replace(\".md\", \"\")}`, \"\", content);\n break;\n }\n } catch {\n // file not found, try next\n }\n }\n }\n\n return lines.join(\"\\n\");\n }\n\n /**\n * Build the in-process Claude Agent SDK MCP server (runner embedding).\n * Returns `null` when `@anthropic-ai/claude-agent-sdk` is unavailable.\n */\n async buildWorkspaceMcpServer(): Promise<unknown | null> {\n this.log.info(\"building workspace MCP server\");\n try {\n const { buildWorkspaceMcpServer } = await import(\"./adapters/mcp.js\");\n const server = await buildWorkspaceMcpServer(this);\n if (server) this.log.info(\"workspace MCP server ready\");\n else this.log.debug(\"workspace MCP server skipped (no tools)\");\n return server;\n } catch (err) {\n this.log.error(\"workspace MCP server build failed\", err);\n throw err;\n }\n }\n\n /**\n * Build the raw `@modelcontextprotocol/sdk` stdio MCP server — no Claude\n * Agent SDK. Used by the `skaile mcp-server` subprocess. The returned\n * server is not yet connected to a transport.\n */\n async buildWorkspaceMcpStdioServer(): Promise<unknown> {\n this.log.info(\"building workspace stdio MCP server\");\n const { buildWorkspaceMcpStdioServer } = await import(\"./adapters/mcp.js\");\n return buildWorkspaceMcpStdioServer(this);\n }\n\n /**\n * Build and run the stdio MCP server: builds the raw\n * `@modelcontextprotocol/sdk` server and connects a `StdioServerTransport`.\n * Used by the `skaile mcp-server` subprocess.\n */\n async runMcpServerStdio(): Promise<void> {\n this.log.info(\"starting workspace stdio MCP server\");\n const { runMcpServerStdio } = await import(\"./adapters/mcp.js\");\n await runMcpServerStdio(this);\n }\n\n async buildOmpToolSet(): Promise<unknown[]> {\n const { buildOmpToolSet } = await import(\"./adapters/omp.js\");\n return buildOmpToolSet(this);\n }\n\n async buildOmpExtensionSource(): Promise<string> {\n const { buildOmpExtensionSource } = await import(\"./adapters/omp.js\");\n return buildOmpExtensionSource(this.projectDir);\n }\n\n async handleSlashCommand(group: string, args: string[]): Promise<string> {\n const { handleSlashCommand } = await import(\"./adapters/omp.js\");\n return handleSlashCommand(this, group, args);\n }\n}\n","// utils/project-dir.ts\n// Centralised project-directory resolution used by all plugin entry points.\n\n/**\n * Resolve the skaile project directory from environment variables.\n *\n * Resolution order:\n * 1. `SKAILE_PROJECT_DIR` (always checked first)\n * 2. Any additional env var keys supplied by the caller (in order)\n * 3. `process.cwd()` as final fallback\n *\n * @param additionalEnvVars - Optional list of extra environment variable names\n * to check before falling back to `process.cwd()`.\n * @returns Absolute path to the resolved project directory.\n *\n * @example\n * // Claude Code — also checks CLAUDE_PROJECT_DIR\n * const projectDir = resolveProjectDir([\"CLAUDE_PROJECT_DIR\"]);\n *\n * // OMP / standalone — SKAILE_PROJECT_DIR or cwd only\n * const projectDir = resolveProjectDir();\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport function resolveProjectDir(additionalEnvVars?: string[]): string {\n if (process.env.SKAILE_PROJECT_DIR) return process.env.SKAILE_PROJECT_DIR;\n for (const key of additionalEnvVars ?? []) {\n const val = process.env[key];\n if (val) return val;\n }\n return process.cwd();\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WorkspacePlugin } from './chunk-
|
|
1
|
+
import { WorkspacePlugin } from './chunk-2QKVA5Y6.js';
|
|
2
2
|
import { WebSocketServerTransport } from './chunk-WQ7DE5UC.js';
|
|
3
3
|
import { assembleSystemPrompt, buildCapabilitiesPromptSection } from './chunk-W3UDISS2.js';
|
|
4
4
|
import { EventNormalizer } from './chunk-T5XXWWHT.js';
|
|
@@ -6,7 +6,7 @@ import { SUPPORTED_CLOUDS, CLOUD_SECRET_ENV_KEYS } from './chunk-ISQWMBKD.js';
|
|
|
6
6
|
import { classifyClaudeSdkError } from './chunk-GAH4YRCI.js';
|
|
7
7
|
import { createDriver } from './chunk-KF3KDVKT.js';
|
|
8
8
|
import { deployCatalogEntry, undeployCatalogEntry } from './chunk-LV2HPH3C.js';
|
|
9
|
-
import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, ConnectorStartupError, buildSdkConnectorTools, buildSdkFlowTools } from './chunk-
|
|
9
|
+
import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, ConnectorStartupError, buildSdkConnectorTools, buildSdkFlowTools } from './chunk-YODB4IHP.js';
|
|
10
10
|
import { loadConnectorDeclarations, SecretProviderChain, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, deriveSingleMaterializedConnectorDeclaration } from './chunk-Y6FV73IH.js';
|
|
11
11
|
import { renderStimulusPrompt, buildOrchestratorPrompt } from './chunk-DEYYRFQU.js';
|
|
12
12
|
import { PROTOCOL_VERSION } from './chunk-XJOPAGZX.js';
|
|
@@ -4108,6 +4108,31 @@ function buildResourcesAvailablePayload(manager, mcpManager, driverLive, bakedSe
|
|
|
4108
4108
|
}));
|
|
4109
4109
|
return { type: "resources_available", mounts, connectors, mcp_servers };
|
|
4110
4110
|
}
|
|
4111
|
+
async function buildStoreSnapshotReplay(manager, activeFlows) {
|
|
4112
|
+
const events = [];
|
|
4113
|
+
for (const { runId, adapter, handle } of activeFlows) {
|
|
4114
|
+
events.push({
|
|
4115
|
+
type: "state_changed",
|
|
4116
|
+
store: `flow:${runId}`,
|
|
4117
|
+
state: adapter.getExecution(handle)
|
|
4118
|
+
});
|
|
4119
|
+
}
|
|
4120
|
+
for (const { id } of manager?.listConnectors?.() ?? []) {
|
|
4121
|
+
try {
|
|
4122
|
+
if (!manager?.has(id)) continue;
|
|
4123
|
+
const connector = manager.get(id).connector;
|
|
4124
|
+
if (typeof connector.onStoreChange !== "function") continue;
|
|
4125
|
+
const snapshot = await manager.executeOp(id, "get", {});
|
|
4126
|
+
events.push({
|
|
4127
|
+
type: "state_changed",
|
|
4128
|
+
store: id,
|
|
4129
|
+
state: snapshot ? JSON.parse(snapshot) : {}
|
|
4130
|
+
});
|
|
4131
|
+
} catch {
|
|
4132
|
+
}
|
|
4133
|
+
}
|
|
4134
|
+
return events;
|
|
4135
|
+
}
|
|
4111
4136
|
function findAiAssetsRoot(startDir) {
|
|
4112
4137
|
let dir = startDir;
|
|
4113
4138
|
for (let i = 0; i < 6; i++) {
|
|
@@ -4264,6 +4289,75 @@ function planFlowMutate(cmd, ctx) {
|
|
|
4264
4289
|
}
|
|
4265
4290
|
return { kind: "dispatch", dispatchId };
|
|
4266
4291
|
}
|
|
4292
|
+
function hostOpResumeStimulus(op, payload) {
|
|
4293
|
+
switch (op) {
|
|
4294
|
+
case "applyApproval":
|
|
4295
|
+
return {
|
|
4296
|
+
kind: "approval_received",
|
|
4297
|
+
nodeId: String(payload.nodeId ?? ""),
|
|
4298
|
+
decision: payload.decision === "rejected" ? "rejected" : "approved",
|
|
4299
|
+
feedback: typeof payload.feedback === "string" ? payload.feedback : void 0,
|
|
4300
|
+
decidedBy: String(payload.decidedBy ?? "user")
|
|
4301
|
+
};
|
|
4302
|
+
case "applyInput":
|
|
4303
|
+
return {
|
|
4304
|
+
kind: "input_received",
|
|
4305
|
+
nodeId: String(payload.nodeId ?? ""),
|
|
4306
|
+
response: payload.response,
|
|
4307
|
+
providedBy: String(payload.providedBy ?? "user")
|
|
4308
|
+
};
|
|
4309
|
+
case "retryNode":
|
|
4310
|
+
return {
|
|
4311
|
+
kind: "retry_requested",
|
|
4312
|
+
nodeId: String(payload.nodeId ?? ""),
|
|
4313
|
+
requestedBy: String(payload.requestedBy ?? "user")
|
|
4314
|
+
};
|
|
4315
|
+
default:
|
|
4316
|
+
return null;
|
|
4317
|
+
}
|
|
4318
|
+
}
|
|
4319
|
+
function reconstructTypedStimulus(meta) {
|
|
4320
|
+
switch (meta.kind) {
|
|
4321
|
+
case "flow_started":
|
|
4322
|
+
return { kind: "flow_started" };
|
|
4323
|
+
case "user_message":
|
|
4324
|
+
return typeof meta.text === "string" ? {
|
|
4325
|
+
kind: "user_message",
|
|
4326
|
+
text: String(meta.text),
|
|
4327
|
+
senderId: String(meta.senderId ?? "user")
|
|
4328
|
+
} : null;
|
|
4329
|
+
case "approval_received":
|
|
4330
|
+
return {
|
|
4331
|
+
kind: "approval_received",
|
|
4332
|
+
nodeId: String(meta.nodeId),
|
|
4333
|
+
decision: meta.decision === "rejected" ? "rejected" : "approved",
|
|
4334
|
+
feedback: typeof meta.feedback === "string" ? meta.feedback : void 0,
|
|
4335
|
+
decidedBy: String(meta.decidedBy ?? "user")
|
|
4336
|
+
};
|
|
4337
|
+
case "input_received":
|
|
4338
|
+
return {
|
|
4339
|
+
kind: "input_received",
|
|
4340
|
+
nodeId: String(meta.nodeId),
|
|
4341
|
+
response: meta.response,
|
|
4342
|
+
providedBy: String(meta.providedBy ?? "user")
|
|
4343
|
+
};
|
|
4344
|
+
case "retry_requested":
|
|
4345
|
+
return {
|
|
4346
|
+
kind: "retry_requested",
|
|
4347
|
+
nodeId: String(meta.nodeId),
|
|
4348
|
+
requestedBy: String(meta.requestedBy ?? "user")
|
|
4349
|
+
};
|
|
4350
|
+
default:
|
|
4351
|
+
return null;
|
|
4352
|
+
}
|
|
4353
|
+
}
|
|
4354
|
+
function stimulusFromMetas(metas) {
|
|
4355
|
+
for (let i = metas.length - 1; i >= 0; i--) {
|
|
4356
|
+
const typed = reconstructTypedStimulus(metas[i] ?? {});
|
|
4357
|
+
if (typed) return typed;
|
|
4358
|
+
}
|
|
4359
|
+
return { kind: "state_changed" };
|
|
4360
|
+
}
|
|
4267
4361
|
async function startAgentServer(opts) {
|
|
4268
4362
|
const port = opts.port ?? 8080;
|
|
4269
4363
|
const sessionId = opts.sessionId ?? process.env.SKAILE_SESSION_ID ?? "session-unknown";
|
|
@@ -4782,19 +4876,7 @@ async function startAgentServer(opts) {
|
|
|
4782
4876
|
serverLog.warn("driveTurn fired with no active flow", { runId });
|
|
4783
4877
|
return;
|
|
4784
4878
|
}
|
|
4785
|
-
const
|
|
4786
|
-
let stimulus;
|
|
4787
|
-
if (lastKind === "flow_started") {
|
|
4788
|
-
stimulus = { kind: "flow_started" };
|
|
4789
|
-
} else if (lastKind === "user_message" && typeof lastMeta.text === "string") {
|
|
4790
|
-
stimulus = {
|
|
4791
|
-
kind: "user_message",
|
|
4792
|
-
text: String(lastMeta.text),
|
|
4793
|
-
senderId: String(lastMeta.senderId ?? "user")
|
|
4794
|
-
};
|
|
4795
|
-
} else {
|
|
4796
|
-
stimulus = { kind: "state_changed" };
|
|
4797
|
-
}
|
|
4879
|
+
const stimulus = stimulusFromMetas(metas);
|
|
4798
4880
|
const fullPrompt = buildOrchestratorPrompt(
|
|
4799
4881
|
entry.flowDef,
|
|
4800
4882
|
entry.adapter.getExecution(entry.handle),
|
|
@@ -5615,6 +5697,24 @@ async function startAgentServer(opts) {
|
|
|
5615
5697
|
}
|
|
5616
5698
|
case "dispatch": {
|
|
5617
5699
|
await resourceManager.executeOp(plan.dispatchId, cmd.op, cmd.payload ?? {});
|
|
5700
|
+
const resumeStimulus = hostOpResumeStimulus(cmd.op, cmd.payload ?? {});
|
|
5701
|
+
if (resumeStimulus) {
|
|
5702
|
+
const entry = getOnlyActiveFlow();
|
|
5703
|
+
if (entry) {
|
|
5704
|
+
void getOrCreateStimulusBus().signal(entry.connectorId, {
|
|
5705
|
+
promptFragment: renderStimulusPrompt(resumeStimulus),
|
|
5706
|
+
meta: {
|
|
5707
|
+
...resumeStimulus,
|
|
5708
|
+
runId: entry.runId
|
|
5709
|
+
}
|
|
5710
|
+
}).catch((err) => {
|
|
5711
|
+
serverLog.warn("host-op resume turn failed", {
|
|
5712
|
+
op: cmd.op,
|
|
5713
|
+
error: err instanceof Error ? err.message : String(err)
|
|
5714
|
+
});
|
|
5715
|
+
});
|
|
5716
|
+
}
|
|
5717
|
+
}
|
|
5618
5718
|
return;
|
|
5619
5719
|
}
|
|
5620
5720
|
}
|
|
@@ -5893,6 +5993,19 @@ async function startAgentServer(opts) {
|
|
|
5893
5993
|
}
|
|
5894
5994
|
}
|
|
5895
5995
|
transport.onConnect(emitAvailability);
|
|
5996
|
+
async function replayStoreSnapshots() {
|
|
5997
|
+
if (!resourceManager) return;
|
|
5998
|
+
for (const event of await buildStoreSnapshotReplay(resourceManager, activeFlows.values())) {
|
|
5999
|
+
sendEvent(event);
|
|
6000
|
+
}
|
|
6001
|
+
}
|
|
6002
|
+
transport.onConnect(() => {
|
|
6003
|
+
replayStoreSnapshots().catch((err) => {
|
|
6004
|
+
serverLog.warn("store snapshot replay failed", {
|
|
6005
|
+
error: err instanceof Error ? err.message : String(err)
|
|
6006
|
+
});
|
|
6007
|
+
});
|
|
6008
|
+
});
|
|
5896
6009
|
if (secretsMode === "env") {
|
|
5897
6010
|
log(
|
|
5898
6011
|
`[serve] driver=${agentSession.driverType} model=${agentSession.model ?? "(default)"} provider=${agentSession.provider ?? "(default)"} maxTurns=${maxTurns ?? "(default)"}`
|
|
@@ -6063,6 +6176,6 @@ function touchSession(state) {
|
|
|
6063
6176
|
return { ...state, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
6064
6177
|
}
|
|
6065
6178
|
|
|
6066
|
-
export { CLAUDE_CODE_CREDENTIALS_KEY, COMPILE_MANIFEST_FILENAME, CapabilityRegistry, DEFAULT_CAPABILITY_CALL_TIMEOUT_MS, DEFAULT_COALESCE_MS, MarkdownStreamer, PreInitRingSink, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildConnectorTokenMediator, buildContextSection, buildEnvironmentSection, buildResourcesAvailablePayload, builtinCapabilities, capabilityLogInstance, clearPreInitRingSink, clearSession, compileComposition, computeCapabilitySignature, connectorRefreshKind, createAgentSession, createSessionStimulusBus, defineCapability, deleteSession, dispatchRunnerCapabilityInvocation, emitSystemPromptComposed, ensureGitConfigInclude, extractClaudeAiOauthExpiresAt, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, installPreInitRingSink, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadSession, loadSessionById, mcpAuthSecretKey, newSession, pickRepointedManager, planFlowMutate, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, resetRunnerLogStore, resolveAgentComposition, resolveAgentMixins, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveMixin, runAgentChat, saveSession, setCurrentSession, startAgentServer, touchSession, writeClaudeCodeCredentialsFile };
|
|
6067
|
-
//# sourceMappingURL=chunk-
|
|
6068
|
-
//# sourceMappingURL=chunk-
|
|
6179
|
+
export { CLAUDE_CODE_CREDENTIALS_KEY, COMPILE_MANIFEST_FILENAME, CapabilityRegistry, DEFAULT_CAPABILITY_CALL_TIMEOUT_MS, DEFAULT_COALESCE_MS, MarkdownStreamer, PreInitRingSink, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildConnectorTokenMediator, buildContextSection, buildEnvironmentSection, buildResourcesAvailablePayload, buildStoreSnapshotReplay, builtinCapabilities, capabilityLogInstance, clearPreInitRingSink, clearSession, compileComposition, computeCapabilitySignature, connectorRefreshKind, createAgentSession, createSessionStimulusBus, defineCapability, deleteSession, dispatchRunnerCapabilityInvocation, emitSystemPromptComposed, ensureGitConfigInclude, extractClaudeAiOauthExpiresAt, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, hostOpResumeStimulus, installPreInitRingSink, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadSession, loadSessionById, mcpAuthSecretKey, newSession, pickRepointedManager, planFlowMutate, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, resetRunnerLogStore, resolveAgentComposition, resolveAgentMixins, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveMixin, runAgentChat, saveSession, setCurrentSession, startAgentServer, stimulusFromMetas, touchSession, writeClaudeCodeCredentialsFile };
|
|
6180
|
+
//# sourceMappingURL=chunk-5RKAGH37.js.map
|
|
6181
|
+
//# sourceMappingURL=chunk-5RKAGH37.js.map
|