@skaile/workspaces 6.9.0 → 6.9.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 +8 -0
- package/dist/{asset-feeds-JWRIWLVX.js → asset-feeds-PANNQPEE.js} +6 -6
- package/dist/{asset-feeds-JWRIWLVX.js.map → asset-feeds-PANNQPEE.js.map} +1 -1
- package/dist/asset-manager/index.js +1 -1
- package/dist/bridge/harnesses/claude-sdk.js +3 -3
- package/dist/bridge/harnesses/codex.js +3 -3
- package/dist/bridge/harnesses/continue.js +4 -4
- package/dist/bridge/harnesses/echo.js +2 -2
- package/dist/bridge/harnesses/gemini.js +5 -5
- package/dist/bridge/harnesses/goose.js +4 -4
- package/dist/bridge/harnesses/omp.js +39 -4
- package/dist/bridge/harnesses/omp.js.map +1 -1
- package/dist/bridge/harnesses/opencode.js +4 -4
- package/dist/bridge/harnesses/qwen.js +5 -5
- package/dist/bridge/index.js +7 -7
- package/dist/bridge/src/harnesses/omp.d.ts +11 -0
- package/dist/bridge/src/harnesses/omp.d.ts.map +1 -1
- package/dist/{chunk-PTJZCOBH.js → chunk-2UKNI2HJ.js} +2 -2
- package/dist/{chunk-PTJZCOBH.js.map → chunk-2UKNI2HJ.js.map} +1 -1
- package/dist/{chunk-CFTTXUM2.js → chunk-5J6N6LHL.js} +3 -3
- package/dist/{chunk-CFTTXUM2.js.map → chunk-5J6N6LHL.js.map} +1 -1
- package/dist/{chunk-SQMDFM4N.js → chunk-7TF5MNFK.js} +2 -2
- package/dist/{chunk-SQMDFM4N.js.map → chunk-7TF5MNFK.js.map} +1 -1
- package/dist/{chunk-AVRTZAH2.js → chunk-7UCPGQCW.js} +8 -8
- package/dist/{chunk-AVRTZAH2.js.map → chunk-7UCPGQCW.js.map} +1 -1
- package/dist/{chunk-MPRWVZXF.js → chunk-AQTAULXT.js} +4 -4
- package/dist/{chunk-MPRWVZXF.js.map → chunk-AQTAULXT.js.map} +1 -1
- package/dist/{chunk-SE6OL7Y5.js → chunk-BDAXHJC5.js} +6 -6
- package/dist/{chunk-SE6OL7Y5.js.map → chunk-BDAXHJC5.js.map} +1 -1
- package/dist/{chunk-V3EJYOP2.js → chunk-BLBXOG5Q.js} +4 -4
- package/dist/{chunk-V3EJYOP2.js.map → chunk-BLBXOG5Q.js.map} +1 -1
- package/dist/{chunk-GYBDWW6K.js → chunk-C324IAXI.js} +3 -3
- package/dist/{chunk-GYBDWW6K.js.map → chunk-C324IAXI.js.map} +1 -1
- package/dist/{chunk-5AQLCRR7.js → chunk-CPMLMNI5.js} +4 -4
- package/dist/{chunk-5AQLCRR7.js.map → chunk-CPMLMNI5.js.map} +1 -1
- package/dist/{chunk-JY2JXCL6.js → chunk-DJSGQW2Q.js} +3 -3
- package/dist/{chunk-JY2JXCL6.js.map → chunk-DJSGQW2Q.js.map} +1 -1
- package/dist/{chunk-3EPRTMXY.js → chunk-EMSU6L7K.js} +3 -3
- package/dist/{chunk-3EPRTMXY.js.map → chunk-EMSU6L7K.js.map} +1 -1
- package/dist/{chunk-B2DGCYVC.js → chunk-FZTHL6SK.js} +8 -8
- package/dist/{chunk-B2DGCYVC.js.map → chunk-FZTHL6SK.js.map} +1 -1
- package/dist/{chunk-DZRN3SNG.js → chunk-IISEBVMA.js} +3 -3
- package/dist/{chunk-DZRN3SNG.js.map → chunk-IISEBVMA.js.map} +1 -1
- package/dist/{chunk-AERQFD6T.js → chunk-J45JCYS4.js} +3 -3
- package/dist/{chunk-AERQFD6T.js.map → chunk-J45JCYS4.js.map} +1 -1
- package/dist/{chunk-V2CONXKD.js → chunk-KVTV4LT2.js} +3 -3
- package/dist/{chunk-V2CONXKD.js.map → chunk-KVTV4LT2.js.map} +1 -1
- package/dist/{chunk-72BDCGBB.js → chunk-MPO5CQUZ.js} +3 -3
- package/dist/{chunk-72BDCGBB.js.map → chunk-MPO5CQUZ.js.map} +1 -1
- package/dist/{chunk-WPLZGT5Z.js → chunk-PBEDRYHP.js} +23 -15
- package/dist/chunk-PBEDRYHP.js.map +1 -0
- package/dist/{chunk-5NTB64PW.js → chunk-PLVM6OIV.js} +8 -8
- package/dist/{chunk-5NTB64PW.js.map → chunk-PLVM6OIV.js.map} +1 -1
- package/dist/{chunk-X2B5GMJO.js → chunk-Q5SSRVD5.js} +6 -6
- package/dist/{chunk-X2B5GMJO.js.map → chunk-Q5SSRVD5.js.map} +1 -1
- package/dist/{chunk-T5EIWWEJ.js → chunk-QIV7H3GJ.js} +4 -4
- package/dist/{chunk-T5EIWWEJ.js.map → chunk-QIV7H3GJ.js.map} +1 -1
- package/dist/{chunk-4WB4KSSQ.js → chunk-RP3ML3QD.js} +3 -3
- package/dist/{chunk-4WB4KSSQ.js.map → chunk-RP3ML3QD.js.map} +1 -1
- package/dist/{chunk-NJVHGS7X.js → chunk-RZRJTCP2.js} +3 -3
- package/dist/{chunk-NJVHGS7X.js.map → chunk-RZRJTCP2.js.map} +1 -1
- package/dist/{chunk-YGT3CGPD.js → chunk-S47KU4YB.js} +3 -3
- package/dist/{chunk-YGT3CGPD.js.map → chunk-S47KU4YB.js.map} +1 -1
- package/dist/{chunk-XPKUFOS3.js → chunk-SME3PK4L.js} +3 -3
- package/dist/{chunk-XPKUFOS3.js.map → chunk-SME3PK4L.js.map} +1 -1
- package/dist/{chunk-23Q5LT4U.js → chunk-VEIWFS7Z.js} +2 -2
- package/dist/{chunk-23Q5LT4U.js.map → chunk-VEIWFS7Z.js.map} +1 -1
- package/dist/{chunk-Y2BQWZXT.js → chunk-WEPTGUR4.js} +5 -5
- package/dist/{chunk-Y2BQWZXT.js.map → chunk-WEPTGUR4.js.map} +1 -1
- package/dist/{chunk-Y242OE4B.js → chunk-X5SGUBUV.js} +3 -3
- package/dist/{chunk-Y242OE4B.js.map → chunk-X5SGUBUV.js.map} +1 -1
- package/dist/{chunk-M4G2SVXI.js → chunk-XB4XHGIE.js} +3 -3
- package/dist/{chunk-M4G2SVXI.js.map → chunk-XB4XHGIE.js.map} +1 -1
- package/dist/{chunk-C7L5MFUL.js → chunk-YPTDPN2B.js} +3 -3
- package/dist/{chunk-C7L5MFUL.js.map → chunk-YPTDPN2B.js.map} +1 -1
- package/dist/{chunk-O3FYOS64.js → chunk-ZUROGXJM.js} +5 -5
- package/dist/{chunk-O3FYOS64.js.map → chunk-ZUROGXJM.js.map} +1 -1
- package/dist/{claude-code-YRJIGXTL.js → claude-code-ILZ46SLO.js} +4 -4
- package/dist/{claude-code-YRJIGXTL.js.map → claude-code-ILZ46SLO.js.map} +1 -1
- package/dist/cli/index.js +52 -52
- package/dist/connectors/index.js +8 -8
- package/dist/{connectors-JKT32HZT.js → connectors-KTRUUKWG.js} +11 -11
- package/dist/{connectors-JKT32HZT.js.map → connectors-KTRUUKWG.js.map} +1 -1
- package/dist/{ensure-sources-GUJODKY5.js → ensure-sources-5QWKUIUD.js} +11 -11
- package/dist/{ensure-sources-GUJODKY5.js.map → ensure-sources-5QWKUIUD.js.map} +1 -1
- package/dist/factory-assets/connectors/box.js +8 -8
- package/dist/factory-assets/connectors/deploy.js +8 -8
- package/dist/factory-assets/connectors/devserver.js +8 -8
- package/dist/factory-assets/connectors/flow/adapter.js +8 -8
- package/dist/factory-assets/connectors/flow/run-flow.js +9 -9
- package/dist/factory-assets/connectors/flow.js +8 -8
- package/dist/factory-assets/connectors/git.js +8 -8
- package/dist/factory-assets/connectors/gmail.js +8 -8
- package/dist/factory-assets/connectors/googledrive.js +8 -8
- package/dist/factory-assets/connectors/local.js +8 -8
- package/dist/factory-assets/connectors/mattermost.js +8 -8
- package/dist/factory-assets/connectors/memory.js +8 -8
- package/dist/factory-assets/connectors/minio.js +8 -8
- package/dist/factory-assets/connectors/postgres.js +8 -8
- package/dist/factory-assets/connectors/s3.js +8 -8
- package/dist/factory-assets/connectors/sharepoint.js +8 -8
- package/dist/factory-assets/connectors/sqlite.js +8 -8
- package/dist/factory-assets/connectors/static-server.js +8 -8
- package/dist/factory-assets/connectors/tunnel.js +8 -8
- package/dist/factory-assets/connectors/webdav.js +8 -8
- package/dist/factory-assets/connectors/xstate-store.js +8 -8
- package/dist/factory-assets/connectors/xstate.js +8 -8
- package/dist/{helpers-SO53MRHF.js → helpers-INS4B7OQ.js} +11 -11
- package/dist/{helpers-SO53MRHF.js.map → helpers-INS4B7OQ.js.map} +1 -1
- package/dist/{library-publish-Z5E3YZCZ.js → library-publish-AZTYRASL.js} +24 -24
- package/dist/{library-publish-Z5E3YZCZ.js.map → library-publish-AZTYRASL.js.map} +1 -1
- package/dist/model-endpoint/index.js +3 -3
- package/dist/{open-library-A5OB72FD.js → open-library-3HMXYGUF.js} +12 -12
- package/dist/{open-library-A5OB72FD.js.map → open-library-3HMXYGUF.js.map} +1 -1
- package/dist/{project-KTEUN7KR.js → project-HVNPK2ZF.js} +20 -20
- package/dist/{project-KTEUN7KR.js.map → project-HVNPK2ZF.js.map} +1 -1
- package/dist/runner/index.js +14 -14
- package/dist/runner/src/agent-loop.d.ts.map +1 -1
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/runner/src/turn-end-contract.d.ts.map +1 -1
- package/dist/runner/src/turn-scheduler.d.ts +8 -0
- package/dist/runner/src/turn-scheduler.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +1 -1
- package/dist/sdk/bridge.js +7 -7
- package/dist/sdk/index.js +14 -14
- package/dist/sdk/runner.js +14 -14
- package/dist/{serve-preflight-ODQGVUFL.js → serve-preflight-NHZOKHIC.js} +14 -14
- package/dist/{serve-preflight-ODQGVUFL.js.map → serve-preflight-NHZOKHIC.js.map} +1 -1
- package/dist/{setup-QJDI5YAW.js → setup-EX7Z7XRN.js} +12 -12
- package/dist/{setup-QJDI5YAW.js.map → setup-EX7Z7XRN.js.map} +1 -1
- package/dist/{source-FKOUYMEM.js → source-URRPRGMZ.js} +21 -21
- package/dist/{source-FKOUYMEM.js.map → source-URRPRGMZ.js.map} +1 -1
- package/dist/{source-manifest-publish-JA4TY4Z6.js → source-manifest-publish-ZWRYRJ2U.js} +23 -23
- package/dist/{source-manifest-publish-JA4TY4Z6.js.map → source-manifest-publish-ZWRYRJ2U.js.map} +1 -1
- package/dist/tui/index.js +14 -14
- package/dist/workspace-plugin/adapters/mcp.js +10 -10
- package/dist/workspace-plugin/adapters/omp.js +7 -7
- package/dist/workspace-plugin/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-WPLZGT5Z.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { agentInstanceWarningLines, agentInstanceErrorLines, reportUnknownHarnesses, reportProjectConfig } from './chunk-
|
|
1
|
+
import { agentInstanceWarningLines, agentInstanceErrorLines, reportUnknownHarnesses, reportProjectConfig } from './chunk-DJSGQW2Q.js';
|
|
2
2
|
import { createSpinner } from './chunk-NESV47MF.js';
|
|
3
3
|
import { getKindRegistry } from './chunk-E675QKFG.js';
|
|
4
|
-
import { logInfo, logWarn, S, logErr, TARGET_DEFAULT_HINT, logOk, colorRef, parseHarnessFilter, requireProjectConfig, deferredWarnings, warnPlaceholderBodies, warnFilesOnlyDelegates, warnStaleHarnessCopies, formatSoftDepHint, reportLegacyOmpCopies } from './chunk-
|
|
5
|
-
import { loadAgentManifest, createCompositionContentSource, hashAgentFiles, isCompilePinCurrent, compileComposition, CompositionError, loadCompileManifestFromDir, verifyConventionItems, resolveAgentInstance, isCompositionError, resolveBinding } from './chunk-
|
|
6
|
-
import { AssetManager } from './chunk-
|
|
4
|
+
import { logInfo, logWarn, S, logErr, TARGET_DEFAULT_HINT, logOk, colorRef, parseHarnessFilter, requireProjectConfig, deferredWarnings, warnPlaceholderBodies, warnFilesOnlyDelegates, warnStaleHarnessCopies, formatSoftDepHint, reportLegacyOmpCopies } from './chunk-BLBXOG5Q.js';
|
|
5
|
+
import { loadAgentManifest, createCompositionContentSource, hashAgentFiles, isCompilePinCurrent, compileComposition, CompositionError, loadCompileManifestFromDir, verifyConventionItems, resolveAgentInstance, isCompositionError, resolveBinding } from './chunk-PBEDRYHP.js';
|
|
6
|
+
import { AssetManager } from './chunk-VEIWFS7Z.js';
|
|
7
7
|
import { effectiveComposes } from './chunk-WS3BOCAT.js';
|
|
8
8
|
import { readLock } from './chunk-4KPQ6ILH.js';
|
|
9
9
|
import { agentSourceCacheDir, SourceEntryError, effectiveAgentInstances, resolveSkWorkspaceConfig, resolveAgentDefinitionDir, AgentRefResolutionError } from './chunk-FZO64PLQ.js';
|
|
@@ -267,7 +267,7 @@ async function runRefInstall(ref, opts) {
|
|
|
267
267
|
const spinner = createSpinner();
|
|
268
268
|
spinner.start(`Installing ${ref}`);
|
|
269
269
|
try {
|
|
270
|
-
const { openCatalogSource, openLibrary } = await import('./open-library-
|
|
270
|
+
const { openCatalogSource, openLibrary } = await import('./open-library-3HMXYGUF.js');
|
|
271
271
|
const catalog = await openCatalogSource({ projectDir: path2.resolve(opts.projectDir) });
|
|
272
272
|
if (!supportsInstallManifest(catalog)) {
|
|
273
273
|
throw new Error(
|
|
@@ -321,7 +321,7 @@ async function runYamlInstall(opts) {
|
|
|
321
321
|
}
|
|
322
322
|
if (await reportUnknownHarnesses(projectDir) > 0) process.exit(1);
|
|
323
323
|
try {
|
|
324
|
-
const { ensureSourcesCloned } = await import('./ensure-sources-
|
|
324
|
+
const { ensureSourcesCloned } = await import('./ensure-sources-5QWKUIUD.js');
|
|
325
325
|
const hydrate = ensureSourcesCloned(projectDir, { quiet: true });
|
|
326
326
|
if (hydrate.cloned.length > 0) {
|
|
327
327
|
logOk(`Cloned source(s): ${hydrate.cloned.join(", ")}`);
|
|
@@ -650,5 +650,5 @@ function makeCleanCommand() {
|
|
|
650
650
|
}
|
|
651
651
|
|
|
652
652
|
export { REF_HINT, editedConventionFiles, globalProblems, makeCheckCommand, makeCleanCommand, makeInstallCommand, pinComposedAgents, reportAgentInstances, reportContentHeld, reportInferredHarnesses, reportInstalledSoftDeps, reportMoved, reportPresetExpansions, reportRelocked, reportReplaced, reportRewritten, reportStoreNotChecked, reportStoreNotCheckedForUpdates, runPointerOnlyInstall, runYamlInstall, supportsInstallManifest };
|
|
653
|
-
//# sourceMappingURL=chunk-
|
|
654
|
-
//# sourceMappingURL=chunk-
|
|
653
|
+
//# sourceMappingURL=chunk-PLVM6OIV.js.map
|
|
654
|
+
//# sourceMappingURL=chunk-PLVM6OIV.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../cli/src/agent-pins.ts","../cli/src/commands/project.ts"],"names":["path","confirm"],"mappings":";;;;;;;;;;;;;;;;;AAmCA,SAAS,SAAS,QAAA,EAAgD;AAChE,EAAA,IAAI;AACF,IAAA,OAAO,SAAS,IAAA,CAAK,CAAC,SAAS,cAAA,CAAe,IAAI,MAAM,iBAAiB,CAAA;AAAA,EAC3E,CAAA,CAAA,MAAQ;AAEN,IAAA,OAAO,KAAA;AAAA,EACT;AACF;AASA,eAAsB,iBAAA,CACpB,UAAA,EACA,IAAA,GAA4B,EAAC,EACV;AACnB,EAAA,OAAA,CAAQ,MAAM,uBAAA,CAAwB,UAAA,EAAY,IAAI,CAAA,EAAG,MAAA;AAC3D;AAMA,SAAS,WAAA,CAAY,KAAuB,SAAA,EAA2B;AACrE,EAAA,IAAI,IAAI,KAAA,EAAO;AACb,IAAA,MAAM,IAAI,GAAA,CAAI,KAAA;AACd,IAAA,OAAO,CAAA,EAAG,CAAA,CAAE,GAAG,CAAA,WAAA,EAAc,CAAA,CAAE,OAAO,CAAA,QAAA,EAAW,CAAA,CAAE,cAAc,CAAA,SAAA,EAAY,CAAA,CAAE,aAAa,CAAA,yCAAA,CAAA;AAAA,EAC9F;AACA,EAAA,OAAO,CAAA,EAAG,IAAI,GAAA,IAAO,SAAS,WAAW,SAAS,CAAA,EAAA,EAAK,IAAI,OAAO,CAAA,CAAA,CAAA;AACpE;AASA,eAAsB,uBAAA,CACpB,UAAA,EACA,IAAA,GAA4B,EAAC,EACqB;AAClD,EAAA,MAAM,QAAA,GAAW,oBAAoB,UAAU,CAAA;AAC/C,EAAA,MAAM,SAAmB,EAAC;AAC1B,EAAA,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,GAAA,EAAI;AACZ,IAAA,KAAA,MAAW,CAAA,IAAK,OAAO,OAAA,EAAS;AAC9B,MAAA,KAAA,CAAM,CAAA,QAAA,EAAW,CAAC,CAAA,CAAE,CAAA;AAAA,IACtB;AACA,IAAA,KAAA,MAAW,CAAA,IAAK,OAAO,OAAA,EAAS;AAC9B,MAAA,OAAA,CAAQ,WAAW,CAAA,CAAE,GAAG,CAAA,EAAA,EAAK,CAAA,CAAE,MAAM,CAAA,CAAE,CAAA;AAAA,IACzC;AACA,IAAA,IAAI,MAAA,CAAO,SAAA,CAAU,MAAA,GAAS,CAAA,EAAG;AAC/B,MAAA,OAAA,CAAQ,GAAA,EAAI;AACZ,MAAA,OAAA,CAAQ,CAAA,KAAA,EAAQ,MAAA,CAAO,SAAA,CAAU,MAAM,CAAA,oBAAA,CAAsB,CAAA;AAC7D,MAAA,KAAA,MAAW,CAAA,IAAK,OAAO,SAAA,EAAW;AAChC,QAAA,OAAA,CAAQ,IAAI,CAAA,IAAA,EAAO,CAAA,CAAE,GAAA,CAAI,CAAC,CAAC,CAAA,CAAE,CAAA;AAAA,MAC/B;AAAA,IACF;AACA,IAAA,IAAI,KAAK,GAAA,EAAK;AACZ,MAAA,OAAA,CAAQ,GAAA,EAAI;AACZ,MAAA,KAAA,CAAM,sBAAsB,CAAA;AAAA,IAC9B;AAAA,EACF,CAAC,CAAA;AACL","file":"chunk-5NTB64PW.js","sourcesContent":["/**\n * The compile pin of the agents `skaile add` keeps under `.skaile/cache/agents/<name>/`.\n *\n * An agent that composes an `inline-snapshot` item (a persona, a ruleset, …) runs from\n * `compile_manifest.json`, so it cannot run without one. `add`, `install` and `update` pin\n * such an agent themselves, once per lock revision: a pin that still matches the bytes the\n * lock serves (one `skaile rebuild` wrote, or an earlier add/install) is left alone, and\n * `skaile rebuild` only refreshes it. `update` also re-runs the rebuild for any\n * agent that holds a pin, a convention-only agent (SOUL.md) included, because the update\n * moved the bytes the pin hashes.\n */\n\nimport { existsSync, readdirSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { agentSourceCacheDir } from \"@skaile/workspaces/core\";\nimport {\n CompositionError,\n type CompositionContentSource,\n compileComposition,\n createCompositionContentSource,\n hashAgentFiles,\n isCompilePinCurrent,\n loadAgentManifest,\n loadCompileManifestFromDir,\n resolveBinding,\n} from \"@skaile/workspaces/runner\";\nimport { type AgentComposeItem, effectiveComposes } from \"@skaile/workspaces/types/manifests\";\nimport { logInfo, logWarn } from \"./helpers.ts\";\nimport { getKindRegistry } from \"./open-registry.ts\";\n\n/**\n * Whether `run` cannot start the agent without a compile pin: it declares an `inline-snapshot`\n * item (a persona, a ruleset bound so, ...). The convention files and the other bindings read\n * their source when no pin exists, so such an agent is left unpinned until `skaile rebuild`.\n */\nfunction needsPin(composes: readonly AgentComposeItem[]): boolean {\n try {\n return composes.some((item) => resolveBinding(item) === \"inline-snapshot\");\n } catch {\n // An item of a kind that has no binding: `run` and `rebuild` name it; nothing to pin here.\n return false;\n }\n}\n\n/**\n * Compile every cached agent of the project that declares an `inline-snapshot` composition item\n * and has no current pin. A compile that fails (an item no library or lock serves) is a warning\n * here: `skaile check` and `skaile run` raise the same error for the agent.\n *\n * @returns The names of the agents that were compiled.\n */\nexport async function pinComposedAgents(\n projectDir: string,\n opts: { repin?: boolean } = {},\n): Promise<string[]> {\n return (await pinComposedAgentsReport(projectDir, opts)).pinned;\n}\n\n/**\n * The `Missing:` line `install` prints for a composed asset the lock pins but no copy serves:\n * the same words as for a locked skill the library moved past (p1510).\n */\nfunction missingLine(err: CompositionError, agentName: string): string {\n if (err.moved) {\n const m = err.moved;\n return `${m.key} (library \"${m.library}\" is at ${m.libraryVersion}, locked ${m.lockedVersion}; \\`skaile update\\` moves the lock to it)`;\n }\n return `${err.ref ?? agentName} (agent ${agentName}: ${err.message})`;\n}\n\n/**\n * {@link pinComposedAgents}, plus the agents `run` could not start. An agent with no usable pin\n * whose locked persona or ruleset no library copy serves any more (the library moved on, or the\n * project is a fresh clone) is a `missing` line, not a warning: `install` exits 1 for it and\n * names `skaile update`, the only command that moves the lock (p1510). An agent that still has\n * its pin keeps running from it, so a library bump alone is silent.\n */\nexport async function pinComposedAgentsReport(\n projectDir: string,\n opts: { repin?: boolean } = {},\n): Promise<{ pinned: string[]; missing: string[] }> {\n const cacheDir = agentSourceCacheDir(projectDir);\n const pinned: string[] = [];\n const missing: string[] = [];\n if (!existsSync(cacheDir)) return { pinned, missing };\n for (const entry of readdirSync(cacheDir, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue;\n const agentDir = path.join(cacheDir, entry.name);\n const manifest = await loadAgentManifest(agentDir);\n if (!manifest) continue;\n const wanted = !!manifest.composes?.length && needsPin(manifest.composes);\n // `update` re-runs the rebuild for an agent that was pinned: the pin hashes bytes it moved.\n if (!wanted && !(opts.repin && (await hasCompilePin(agentDir)))) continue;\n const composes = manifest.composes ?? [];\n let items: AgentComposeItem[] = [];\n const source = createCompositionContentSource({\n agentDir,\n projectDir,\n registry: getKindRegistry(),\n });\n try {\n const files = await hashAgentFiles(agentDir);\n items = effectiveComposes(\n composes,\n files.map((f) => f.path),\n );\n if (await isCompilePinCurrent({ agentDir, items, source })) continue;\n const result = await compileComposition({ agentDir, items, source });\n pinned.push(entry.name);\n logInfo(\n `Compiled agent ${manifest.name ?? entry.name} (${result.resolvedCount} composition items) → prompt v${result.manifest.prompt_version}`,\n );\n } catch (err) {\n if (err instanceof CompositionError && err.code === \"composition_asset_missing\") {\n // The bytes the lock pins are gone, but the pin that was compiled from them still\n // serves `run`: nothing for install to report.\n if (await hasCompilePin(agentDir)) continue;\n for (const line of await missingLines(items, source, err, entry.name)) {\n if (!missing.includes(line)) missing.push(line);\n }\n continue;\n }\n const reason = err instanceof Error ? err.message : String(err);\n const code = err && typeof err === \"object\" && \"code\" in err ? `${String(err.code)}: ` : \"\";\n logWarn(`Could not compile agent ${entry.name}: ${code}${reason}`);\n }\n }\n return { pinned, missing };\n}\n\n/** Whether the agent folder holds a readable compile pin. */\nasync function hasCompilePin(agentDir: string): Promise<boolean> {\n try {\n return (await loadCompileManifestFromDir(agentDir)) !== undefined;\n } catch {\n return false;\n }\n}\n\n/** One line per item the source cannot serve (the compile names only the first). */\nasync function missingLines(\n items: readonly AgentComposeItem[],\n source: CompositionContentSource,\n first: CompositionError,\n agentName: string,\n): Promise<string[]> {\n const lines = [missingLine(first, agentName)];\n for (const item of items) {\n try {\n await source.load(item.ref, item.kind);\n } catch (err) {\n if (err instanceof CompositionError && err.code === \"composition_asset_missing\") {\n lines.push(missingLine(err, agentName));\n }\n }\n }\n return [...new Set(lines)];\n}\n\n/**\n * The items of the agent that a rebuild could not serve because a registered library moved past\n * the version the lock pins: each error names `skaile update`, the command that moves the lock.\n * `check` prints these instead of sending the user to a `skaile rebuild` that would fail with\n * the same lines. Empty when a rebuild can read every item.\n */\nexport async function lockBehindLibraryErrors(\n agentDir: string,\n projectDir: string,\n): Promise<CompositionError[]> {\n const manifest = await loadAgentManifest(agentDir);\n if (!manifest) return [];\n const files = await hashAgentFiles(agentDir);\n const items = effectiveComposes(\n manifest.composes,\n files.map((f) => f.path),\n );\n const source = createCompositionContentSource({\n agentDir,\n projectDir,\n registry: getKindRegistry(),\n });\n const out: CompositionError[] = [];\n for (const item of items) {\n try {\n await source.load(item.ref, item.kind);\n } catch (err) {\n if (\n err instanceof CompositionError &&\n err.code === \"composition_asset_missing\" &&\n err.moved\n ) {\n out.push(err);\n }\n }\n }\n return out;\n}\n","import { homedir } from \"node:os\";\nimport path from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport {\n AssetManager,\n type ContentHeld,\n type InstalledAgentInstance,\n type LibraryMove,\n type ReplacedAsset,\n type RewrittenAgent,\n} from \"@skaile/workspaces/asset-manager\";\nimport {\n type AgentInstanceConfig,\n AgentRefResolutionError,\n type HarnessName,\n effectiveAgentInstances,\n globalSkaileDir,\n type PresetExpansion,\n parseAssetRef,\n readLock,\n resolveAgentDefinitionDir,\n resolveSkWorkspaceConfig,\n SourceEntryError,\n userConfigPath,\n} from \"@skaile/workspaces/core\";\nimport {\n isCompositionError,\n loadAgentManifest,\n resolveAgentInstance,\n verifyConventionItems,\n} from \"@skaile/workspaces/runner\";\nimport type { InstallManifest } from \"@skaile/workspaces/types\";\nimport { Command } from \"commander\";\nimport {\n colorRef,\n requireProjectConfig,\n formatSoftDepHint,\n deferredWarnings,\n logErr,\n logInfo,\n logOk,\n logWarn,\n parseHarnessFilter,\n reportLegacyOmpCopies,\n S,\n TARGET_DEFAULT_HINT,\n warnFilesOnlyDelegates,\n warnStaleHarnessCopies,\n warnPlaceholderBodies,\n} from \"../helpers.ts\";\nimport {\n agentInstanceErrorLines,\n agentInstanceWarningLines,\n reportProjectConfig,\n reportUnknownHarnesses,\n} from \"../config-checks.ts\";\nimport { createSpinner } from \"../spinner.ts\";\nimport { getKindRegistry } from \"../open-registry.ts\";\nimport { lockBehindLibraryErrors, pinComposedAgentsReport } from \"../agent-pins.ts\";\n\n/**\n * Canonical asset-ref shape accepted by `skaile install <ref>`:\n * `kind:@<publisher>/<name>#<version>` (the `#` version sigil). Validated via\n * `parseAssetRef` so the CLI shares the single canonical grammar; the legacy\n * trailing-`@version` shape is rejected.\n */\nexport const REF_HINT = \"kind:@<publisher>/<name>#<version> (e.g. skill:@skaile-ai/use-exa#1.0.0)\";\n\n/** True when `ref` parses as a canonical asset ref. */\nfunction isValidAssetRef(ref: string): boolean {\n try {\n parseAssetRef(ref);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Minimal catalog-source surface the pointer-only install path needs.\n * `RemoteCatalogSource` satisfies this — narrowing keeps {@link runPointerOnlyInstall}\n * testable with a hand-rolled stub.\n */\nexport interface InstallManifestSource {\n getInstallManifest(ref: string): Promise<InstallManifest>;\n}\n\n/**\n * Capability check: is this catalog source able to serve install manifests?\n *\n * `openCatalogSource` returns a `RemoteCatalogSource | RestCatalogSource`.\n * Only the tRPC-framed `RemoteCatalogSource` implements `getInstallManifest`;\n * the REST-framed `RestCatalogSource` (the default for any catalog URL other\n * than `https://skaile.store`) does not. Calling it unconditionally would be a\n * runtime `TypeError`, so the pointer-only install path must capability-detect\n * first and fail with a clear, actionable message.\n */\nexport function supportsInstallManifest(source: unknown): source is InstallManifestSource {\n return (\n typeof (source as { getInstallManifest?: unknown } | null | undefined)?.getInstallManifest ===\n \"function\"\n );\n}\n\n/**\n * Minimal library surface the pointer-only install path needs.\n * `LocalIndex` satisfies this.\n */\nexport interface InstallLibrary {\n install(manifest: InstallManifest): Promise<{ installPath: string }>;\n}\n\n/**\n * Result of a pointer-only catalog install.\n */\nexport interface PointerOnlyInstallResult {\n /** Absolute path the verified asset bytes were written to. */\n installPath: string;\n /** The pinned upstream commit SHA the asset was fetched at. */\n commitSha: string;\n /** Number of files in the install manifest. */\n fileCount: number;\n}\n\n/**\n * Pointer-only catalog install — the `skaile install <ref>` code path.\n *\n * 1. Resolves the pointer-only {@link InstallManifest} from the Catalog.\n * 2. Hands it to the library, which fetches each file's bytes directly from\n * the upstream repo at the pinned commit, verifies every per-file SHA256\n * plus the composite SHA256, and only then writes the verified files.\n *\n * Both dependencies are injected so the function is unit-testable without a\n * network round-trip. In production the CLI passes a `RemoteCatalogSource`\n * and a `LocalIndex`.\n *\n * @param ref - Canonical asset ref (`kind:@<publisher>/<name>#<version>`).\n * @param deps - Injected catalog source + library.\n * @returns The install path, pinned commit SHA, and file count.\n * @throws When the ref is malformed, the manifest cannot be resolved, or any\n * hash verification fails. The underlying error message is surfaced as-is.\n */\nexport async function runPointerOnlyInstall(\n ref: string,\n deps: { catalog: InstallManifestSource; library: InstallLibrary },\n): Promise<PointerOnlyInstallResult> {\n let requested: ReturnType<typeof parseAssetRef>;\n try {\n requested = parseAssetRef(ref);\n } catch (e) {\n throw new Error(\n `malformed asset ref '${ref}' — expected ${REF_HINT}: ${e instanceof Error ? e.message : String(e)}`,\n );\n }\n const manifest = await deps.catalog.getInstallManifest(ref);\n // [M1] Identity check: the catalog must not install a different asset than\n // requested. Compare the PARSED refs (kind/publisher/name/pin) so equivalent\n // spellings (optional `kind:`, default `skill`) are treated as the same ref.\n const got = parseAssetRef(manifest.ref);\n if (\n got.kind !== requested.kind ||\n got.publisher !== requested.publisher ||\n got.name !== requested.name ||\n got.pin !== requested.pin\n ) {\n throw new Error(\n `catalog identity mismatch: requested '${ref}' but the catalog returned a manifest for '${manifest.ref}'`,\n );\n }\n const { installPath } = await deps.library.install(manifest);\n return {\n installPath,\n commitSha: manifest.source.commitSha,\n fileCount: manifest.files.length,\n };\n}\n\n/**\n * Print one summary line per `preset:` dependency `skaile install` expanded: how many\n * asset items joined the install set and how many instance items (`library://`,\n * placeholders) were skipped, which only `skaile preset apply` materialises.\n */\nexport function reportPresetExpansions(\n presets: readonly PresetExpansion[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const preset of presets ?? []) {\n onLine(\n `preset ${preset.ref}: ${preset.assets} assets, ${preset.skipped} instance items skipped (apply with skaile preset apply)`,\n );\n }\n}\n\n/**\n * Print one line per agent instance `skaile install` rendered (with the files\n * written) and one per native agent file removed because its instance left `skaile.yaml`.\n */\nexport function reportAgentInstances(\n instances: readonly InstalledAgentInstance[] | undefined,\n removedFiles: readonly string[] | undefined,\n onLine: (line: string) => void = logInfo,\n onRemoved: (line: string) => void = logWarn,\n): void {\n for (const instance of instances ?? []) {\n onLine(`agent ${instance.id}: ${instance.files.join(\", \")}`);\n }\n for (const file of removedFiles ?? []) onRemoved(`Removed: ${file}`);\n}\n\n/** One `Re-locked` line per lock entry `install`/`update` rewrote for an already-locked asset. */\nexport function reportRelocked(\n relocked: string[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const ref of relocked ?? []) onLine(`Re-locked ${ref}`);\n}\n\n/**\n * One line per locked library asset whose library holds the locked version with other bytes.\n * `install` keeps the lock and the deployed copy; only `update` takes the edit (OQ13, p1911).\n * The project does not match its library, as `check` says, so the run exits 1.\n */\nexport function reportContentHeld(\n held: ContentHeld[] | undefined,\n onLine: (line: string) => void = logWarn,\n): void {\n for (const h of held ?? []) {\n onLine(\n `${h.ref.split(\"#\")[0]}: library \"${h.library}\" changed since lock (same version ${h.version}). Run ${S.cmd(\"skaile update\")} to take the change.`,\n );\n process.exitCode = 1;\n }\n}\n\n/** One line per global entry `install --global` limited to the one harness that holds its copy (p1442). */\nexport function reportInferredHarnesses(\n inferred: readonly { ref: string; harnesses: readonly string[] }[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const i of inferred ?? []) {\n onLine(\n `${i.ref} stays on ${i.harnesses.join(\", \")} (its only copy); add it to another harness with \\`skaile add ${i.ref} --global --harness <id>\\``,\n );\n }\n}\n\n/** One `! <ref> moved from <a> to <b>` line per locked asset that now resolves from another library. */\nexport function reportMoved(\n moved: readonly LibraryMove[] | undefined,\n onLine: (line: string) => void = logWarn,\n): void {\n for (const m of moved ?? []) onLine(`${m.ref} moved from ${m.from} to ${m.to}`);\n}\n\n/** One `replaced <old> → <new>` line per asset `install`/`update` moved to another locked version. */\nexport function reportReplaced(\n replaced: readonly ReplacedAsset[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const r of replaced ?? []) onLine(`${r.ref} replaced ${r.from} → ${r.to}`);\n}\n\n/** One `Rewrote <file> (agent render changed)` line per rendered agent file whose bytes the CLI's render changed. */\nexport function reportRewritten(\n rewritten: readonly RewrittenAgent[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const r of rewritten ?? []) {\n for (const f of r.files) onLine(`Rewrote ${f} (agent render changed)`);\n }\n}\n\n/**\n * Say which locked store assets `install`/`update` did not check against the store (p792,\n * p799). A chosen mode (air-gapped, `--no-catalog`) is one info line per asset; a store that\n * did not answer is an error line `store unreachable: could not check <ref> for updates`.\n *\n * @returns Whether any asset could not be checked because the store was unreachable: the\n * command then ends `Failed` with exit 1.\n */\nexport function reportStoreNotChecked(\n notChecked: readonly { ref: string; reason: string; detail: string }[] | undefined,\n): boolean {\n let unreachable = false;\n for (const n of notChecked ?? []) {\n if (n.reason === \"unreachable\") {\n unreachable = true;\n logErr(`store unreachable: could not check ${n.ref} for updates (${n.detail})`);\n } else if (n.reason === \"air-gapped\") {\n logInfo(`${n.ref} kept as locked (air-gapped: not checked against the store)`);\n } else {\n logInfo(`${n.ref} kept as locked (${n.detail})`);\n }\n }\n return unreachable;\n}\n\n/**\n * Say which refs `outdated`, `check` or `doctor` could not check against the store\n * (`AssetManager.takeStoreNotChecked`). A store that did not answer is one error\n * line per ref (`store unreachable: <ref> not checked (<why>)`); an air-gapped client\n * (`catalog.cache_ttl: 0`) chose not to ask, so its refs are one info line each.\n *\n * @returns Whether any ref was not checked because the store was unreachable: the command then\n * exits 1, as `install` and `update` do.\n */\nexport function reportStoreNotCheckedForUpdates(\n notChecked: readonly { ref: string; reason: string; detail: string }[],\n): boolean {\n let unreachable = false;\n for (const n of notChecked) {\n if (n.reason === \"air-gapped\") {\n logInfo(`${n.ref} not checked (air-gapped: the store was not asked)`);\n } else {\n unreachable = true;\n logErr(`store unreachable: ${n.ref} not checked (${n.detail})`);\n }\n }\n return unreachable;\n}\n\n/**\n * Creates the `skaile install` command.\n *\n * Two modes, selected by argument shape:\n *\n * - `skaile install` (no positional arg) — reads `skaile.yaml` and deploys all\n * declared assets (and their transitive dependencies) to the configured\n * harness target directory. Supports `--locked` for CI-mode install from a\n * lock file.\n * - `skaile install kind:@<publisher>/<name>#<version>` — pointer-only catalog\n * install: resolves the pointer-only install manifest from the configured\n * Catalog, fetches each file's bytes directly from the upstream repo at the\n * pinned commit, verifies every per-file + the composite SHA256, then writes\n * the verified files into the local Library.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-install-command\n */\nexport function makeInstallCommand(): Command {\n return new Command(\"install\")\n .description(`Install dependencies from skaile.yaml, or a single asset by ref (${REF_HINT})`)\n .argument(\"[ref]\", `Asset ref to install from the Catalog (${REF_HINT})`)\n .option(\"--locked\", \"Install from lock file (CI mode — fails on drift)\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--target <agent>\", `Agent framework (${TARGET_DEFAULT_HINT})`)\n .option(\n \"--global\",\n \"Install the global SSOT (~/.skaile/skaile.yaml), fanning out to every global harness\",\n )\n .option(\n \"--harness <ids>\",\n \"Comma-separated global harnesses to install into (default: all resolved); implies --global\",\n )\n .option(\n \"--link\",\n \"symlink local-path assets instead of copying (dev loop; machine-local, not for committing)\",\n )\n .option(\n \"--force\",\n \"Deploy over a folder no lock entry owns (a hand-made skill of the same name), and prune an undeclared asset whose folder holds your edits, instead of refusing\",\n )\n .option(\n \"--verbose\",\n \"also print the resolver's searched directories for an agent it cannot find\",\n )\n .action(runInstallCommand);\n}\n\n/** Options shape accepted by the `skaile install` command action. */\nexport interface InstallCommandOptions {\n locked?: boolean;\n projectDir: string;\n target?: string;\n global?: boolean;\n harness?: string;\n link?: boolean;\n force?: boolean;\n verbose?: boolean;\n}\n\n/**\n * `skaile install` action body. Dispatches by argument shape:\n * a positional `ref` selects pointer-only catalog install, otherwise the\n * legacy `skaile.yaml` install path runs.\n */\nasync function runInstallCommand(\n ref: string | undefined,\n opts: InstallCommandOptions,\n): Promise<void> {\n // ── Pointer-only catalog install: `skaile install <ref>` ──────────────\n if (ref !== undefined) {\n await runRefInstall(ref, opts);\n return;\n }\n\n // ── Legacy install: `skaile install` reads skaile.yaml ────────────────\n await runYamlInstall(opts);\n}\n\n/** Pointer-only catalog install path for `skaile install <ref>`. */\nasync function runRefInstall(ref: string, opts: InstallCommandOptions): Promise<void> {\n if (!isValidAssetRef(ref)) {\n logErr(`malformed asset ref '${ref}' — expected ${REF_HINT}`);\n process.exit(1);\n }\n // The store installs one exact version; without `#<version>` it answers a bare 400, so say\n // what is missing before the call.\n if (!parseAssetRef(ref).pin) {\n logErr(\n `${ref} needs a version: use ${ref}#<version>. A library asset is deployed with \\`skaile add ${ref}\\`, not \\`skaile install\\`.`,\n );\n process.exit(1);\n }\n const spinner = createSpinner();\n spinner.start(`Installing ${ref}`);\n try {\n const { openCatalogSource, openLibrary } = await import(\"../open-library.ts\");\n const catalog = await openCatalogSource({ projectDir: path.resolve(opts.projectDir) });\n // [H2] REST-framed catalogs (the default for any catalog URL other\n // than https://skaile.store) cannot serve install manifests. Detect\n // and fail clearly rather than throwing a runtime TypeError.\n if (!supportsInstallManifest(catalog)) {\n throw new Error(\n \"pointer-only install (skaile install <ref>) requires a tRPC-framed Catalog. \" +\n \"The configured catalog uses REST framing, which does not serve install \" +\n \"manifests. Set catalog.url to https://skaile.store, or catalog.framing: trpc, \" +\n `in ${userConfigPath()}.`,\n );\n }\n const library = await openLibrary();\n try {\n const result = await runPointerOnlyInstall(ref, { catalog, library });\n spinner.stop(\"Done\");\n logOk(`Installed ${colorRef(ref)}`);\n logInfo(`Path: ${S.dim(result.installPath)}`);\n logInfo(`Commit: ${S.dim(result.commitSha)}`);\n logInfo(`Files: ${S.dim(String(result.fileCount))}`);\n logInfo(\n S.dim(\n `Installed globally (see Path above) — use \\`skaile add ${ref}\\` to deploy into this project.`,\n ),\n );\n } finally {\n library.close();\n }\n } catch (err) {\n spinner.stop(\"Failed\");\n const msg = err instanceof Error ? err.message : String(err);\n if (/failed: 404\\b/.test(msg)) {\n logErr(\n `${ref} is not in the store. For a library asset use \\`skaile add ${ref.replace(/#.*$/, \"\")}\\`.`,\n );\n } else if (/unreachable/i.test(msg)) {\n logErr(`asset uninstallable — source commit no longer available (${msg})`);\n } else {\n logErr(msg);\n }\n process.exit(1);\n }\n}\n\n/** Legacy install path for bare `skaile install` (reads skaile.yaml). Also runs `skaile harness set`. */\nexport async function runYamlInstall(opts: InstallCommandOptions): Promise<void> {\n const projectDir = path.resolve(opts.projectDir);\n\n const harnesses = parseHarnessFilter(opts.harness);\n // `--harness` implies `--global`.\n if (opts.global || harnesses) {\n await runGlobalInstall(opts, harnesses);\n return;\n }\n\n // A project without a readable skaile.yaml stops here, before sources are cloned, assets\n // are deployed or undeployed, or the lock is written.\n requireProjectConfig(projectDir);\n\n // Refuse what `validate` rejects for the `agents:` map, before anything is written (p1512);\n // a key of `agent:` or `agents:` that nothing reads warns (p1712).\n for (const line of agentInstanceWarningLines(projectDir)) logWarn(line);\n const instanceErrors = agentInstanceErrorLines(projectDir);\n if (instanceErrors.length > 0) {\n for (const line of instanceErrors) logErr(line);\n process.exit(1);\n }\n // A `harness:` nothing registers fails as in `validate` and `check` (p1754).\n if ((await reportUnknownHarnesses(projectDir)) > 0) process.exit(1);\n\n // Hydrate sources declared in skaile.yaml before resolving assets, so\n // freshly checked-out projects pull their source clones automatically.\n try {\n const { ensureSourcesCloned } = await import(\"../ensure-sources.ts\");\n const hydrate = ensureSourcesCloned(projectDir, { quiet: true });\n if (hydrate.cloned.length > 0) {\n logOk(`Cloned source(s): ${hydrate.cloned.join(\", \")}`);\n }\n if (hydrate.failed.length > 0) {\n logErr(`Failed to clone source(s): ${hydrate.failed.join(\", \")}`);\n }\n } catch (err) {\n logWarn(`source hydration skipped: ${err instanceof Error ? err.message : String(err)}`);\n }\n\n const warnings = deferredWarnings();\n const am = new AssetManager({\n registry: getKindRegistry(),\n projectDir,\n harness: opts.target as HarnessName,\n onLibraryCollision: warnings.push,\n });\n const spinner = createSpinner();\n spinner.start(opts.locked ? \"Installing from lock file\" : \"Installing dependencies\");\n try {\n const result = await am.install({ locked: opts.locked, link: opts.link, force: opts.force });\n const storeUnreachable = result.storeNotChecked?.some((n) => n.reason === \"unreachable\");\n spinner.stop(\n result.agentInstanceErrors?.length ||\n result.missing.length > 0 ||\n storeUnreachable ||\n result.contentHeld?.length\n ? \"Failed\"\n : \"Done\",\n );\n warnings.flush();\n if (result.deployed.length > 0) {\n for (const d of result.deployed) logOk(d);\n }\n warnPlaceholderBodies(result.placeholderBodies, result.placeholderDescriptions);\n for (const r of result.restored ?? []) {\n for (const f of r.restored) logInfo(`Restored ${f}`);\n for (const f of r.removed) logInfo(`Removed ${f} (not part of ${r.ref})`);\n }\n reportRewritten(result.rewritten);\n for (const line of result.libraryNotices ?? []) logInfo(line);\n reportPresetExpansions(result.presets);\n reportAgentInstances(result.agentInstances, result.agentFilesRemoved);\n // Said when this install wrote an agent file (a fresh clone, a changed agent), not when it only\n // restored a skill or did nothing (p1673).\n if (\n result.deployed.some((d) => d.startsWith(\"agent:\")) ||\n result.replaced?.some((r) => r.ref.startsWith(\"agent:\")) ||\n result.agentInstancesChanged?.length\n ) {\n warnFilesOnlyDelegates(am.projectDir, am.harness);\n }\n if (result.removed.length > 0) {\n for (const r of result.removed) logWarn(`Removed: ${r}`);\n }\n reportReplaced(result.replaced);\n reportRelocked(result.relocked);\n reportMoved(result.moved);\n reportContentHeld(result.contentHeld);\n const pins = await pinComposedAgentsReport(projectDir);\n const missing = [...result.missing, ...pins.missing];\n if (\n result.deployed.length === 0 &&\n result.removed.length === 0 &&\n !result.replaced?.length &&\n missing.length === 0 &&\n !result.storeNotChecked?.length &&\n !result.restored?.length &&\n !result.relocked?.length &&\n !result.contentHeld?.length &&\n !result.moved?.length &&\n !result.agentInstanceErrors?.length\n ) {\n logInfo(\"Nothing to install (already up to date).\");\n }\n if (result.agentInstanceErrors?.length) {\n if (opts.verbose) for (const d of result.agentInstanceDetails ?? []) logInfo(S.dim(d));\n logErr(\n `${result.agentInstanceErrors.length} agent instance(s) could not be rendered (see above)`,\n );\n process.exitCode = 1;\n }\n if (missing.length > 0) {\n for (const m of missing) logErr(`Missing: ${m}${result.missingHints?.[m] ?? \"\"}`);\n // Partial-miss must fail the process — CI can't otherwise distinguish a\n // clean install from \"half the assets never resolved\".\n process.exitCode = 1;\n }\n if (reportStoreNotChecked(result.storeNotChecked)) process.exitCode = 1;\n // A ref that only resolved once the assets were installed (a catalog agent) is checked now.\n const lateInstanceErrors = agentInstanceErrorLines(projectDir);\n for (const line of lateInstanceErrors) logErr(line);\n if (lateInstanceErrors.length > 0) process.exitCode = 1;\n if (result.lockWritten) {\n logInfo(`Lock file written: ${S.dim(\"skaile.lock.yaml\")}`);\n }\n warnStaleHarnessCopies(am);\n // Report-only: surface soft deps the declared assets reference but aren't\n // present. Never a prompt — install is a batch/CI path. Skipped under\n // --locked: that mode is \"restore exactly\", so an `add` nudge would jar.\n if (!opts.locked) await reportInstalledSoftDeps(am);\n } catch (err) {\n spinner.stop(\"Failed\");\n logErr(err instanceof SourceEntryError ? err.message : String(err));\n process.exit(1);\n }\n}\n\n/**\n * Report (never prompt) the body-link soft deps that the declared assets\n * reference but that aren't in the project — the `install` counterpart to the\n * `add`-time soft-dep surface. `install` is a batch/CI path (often non-TTY), so\n * it only ever prints a hint: pulling stays an explicit `skaile add`. Best-effort\n * — `reportSoftDeps` swallows any index failure and returns `[]`.\n */\nexport async function reportInstalledSoftDeps(\n am: Pick<AssetManager, \"listDeclared\" | \"reportSoftDeps\">,\n onHint: (line: string) => void = (l) => logInfo(S.dim(l)),\n): Promise<void> {\n try {\n const declared = (await am.listDeclared()).map((d) => d.ref);\n if (declared.length === 0) return;\n const edges = await am.reportSoftDeps(declared);\n for (const edge of edges) onHint(formatSoftDepHint(edge));\n } catch {\n // Best-effort: a soft-dep report must never fail an install that succeeded.\n }\n}\n\n/**\n * Global cross-harness install: deploy every dep declared in the global SSOT\n * (`~/.skaile/skaile.yaml`) into each resolved global harness's dir under `~`,\n * write the global lock (`~/.skaile/skaile.lock.yaml`), then print per-harness\n * state. `harnesses` is the `--harness` filter (omit for the full resolved set).\n */\nasync function runGlobalInstall(\n opts: InstallCommandOptions,\n harnesses: HarnessName[] | undefined,\n): Promise<void> {\n const am = new AssetManager({\n registry: getKindRegistry(),\n projectDir: path.resolve(opts.projectDir),\n global: true,\n harnesses,\n });\n const spinner = createSpinner();\n spinner.start(\"Installing global dependencies\");\n try {\n const result = await am.install({ locked: opts.locked, link: opts.link, force: opts.force });\n const storeUnreachable = result.storeNotChecked?.some((n) => n.reason === \"unreachable\");\n spinner.stop(\n result.missing.length > 0 || storeUnreachable || result.contentHeld?.length\n ? \"Failed\"\n : \"Done\",\n );\n if (result.deployed.length > 0) for (const d of result.deployed) logOk(d);\n warnPlaceholderBodies(result.placeholderBodies, result.placeholderDescriptions);\n reportPresetExpansions(result.presets);\n if (result.removed.length > 0) for (const r of result.removed) logWarn(`Removed: ${r}`);\n reportReplaced(result.replaced);\n reportRelocked(result.relocked);\n reportInferredHarnesses(result.inferredHarnesses);\n reportMoved(result.moved);\n reportContentHeld(result.contentHeld);\n if (\n result.deployed.length === 0 &&\n result.removed.length === 0 &&\n !result.replaced?.length &&\n result.missing.length === 0 &&\n !result.storeNotChecked?.length &&\n !result.relocked?.length &&\n !result.contentHeld?.length &&\n !result.moved?.length\n )\n logInfo(\"Nothing to install (already up to date).\");\n if (reportStoreNotChecked(result.storeNotChecked)) process.exitCode = 1;\n if (result.missing.length > 0) {\n for (const m of result.missing) logErr(`Missing: ${m}${result.missingHints?.[m] ?? \"\"}`);\n process.exitCode = 1;\n }\n if (result.lockWritten) logInfo(`Global lock written: ${S.dim(\"~/.skaile/skaile.lock.yaml\")}`);\n reportLegacyOmpCopies(am.takeLegacyCopiesRemoved(), am.takeLegacyCopiesKept());\n\n // Per-harness reconciliation summary so a partial fan-out is visible.\n const state = am.globalState({});\n const byHarness = new Map<string, number>();\n for (const s of state)\n if (s.state === \"installed\") byHarness.set(s.harness, (byHarness.get(s.harness) ?? 0) + 1);\n for (const [harness, n] of byHarness) logInfo(`${harness}: ${n} installed`);\n } catch (err) {\n spinner.stop(\"Failed\");\n logErr(String(err));\n process.exit(1);\n }\n}\n\n/** The `--global` options of `check`, `doctor` and `clean`. */\ninterface GlobalScopeOptions {\n global?: boolean;\n harness?: string;\n projectDir: string;\n}\n\n/** A manager over the user-scope SSOT (`~/.skaile`), limited to `--harness` when given. */\nfunction globalManager(opts: GlobalScopeOptions): AssetManager {\n return new AssetManager({\n registry: getKindRegistry(),\n projectDir: path.resolve(opts.projectDir),\n global: true,\n harnesses: parseHarnessFilter(opts.harness),\n });\n}\n\n/**\n * What is wrong with the global install: one line per declared asset a harness does not hold\n * (`list --global` calls these `declared` and `drift`), per invalid entry, and per old\n * `~/.omp/<dir>` copy a 5.12.0 install left behind. Empty when the global state is clean (p911).\n */\nexport function globalProblems(am: AssetManager): string[] {\n const lines = new Set<string>();\n for (const row of am.globalState({})) {\n if (row.state === \"declared\") {\n lines.add(\n `${row.ref} is declared in ~/.skaile/skaile.yaml but not installed: run skaile install --global`,\n );\n } else if (row.state === \"drift\") {\n lines.add(\n `${row.ref} is missing from ${row.harness}: run skaile install --global --harness ${row.harness}`,\n );\n } else if (row.state === \"invalid\") {\n lines.add(`${row.ref} in ~/.skaile/skaile.yaml is not a valid asset ref`);\n }\n }\n for (const stale of am.staleLegacyOmpCopies()) {\n lines.add(\n `${stale.path.replace(homedir(), \"~\")} is an old omp copy of ${stale.ref} (omp reads ~/.omp/agent): run skaile install --global --harness omp, or delete it`,\n );\n }\n return [...lines];\n}\n\n/**\n * Creates the `skaile check` command.\n *\n * Fails (exit 1) on every problem {@link AssetManager.projectState} reports: unmet\n * requirements of deployed assets, a declared dep that never resolved into the lock (its\n * library or source is gone, like `skaile list` showing it as `declared`) or never\n * materialized (e.g. a store-sourced `mcp-server`, #462), a locked asset whose library is\n * gone or whose deployed copy or files are missing, a locked library asset whose files\n * changed since the lock (or whose lock hash predates the shared asset hash), and an\n * `agents.<id>.ref` that binds to no agent. `doctor`, `outdated`, `diff` and\n * `install --locked` take their verdict from the same state.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-check-command\n */\nexport function makeCheckCommand(): Command {\n return new Command(\"check\")\n .description(\"Check for unmet requirements\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--global\", \"Check the global install (~/.skaile) instead of the project\")\n .option(\"--harness <ids>\", \"With --global: only these harnesses (comma-separated)\")\n .action(async (opts) => {\n if (opts.global || opts.harness) {\n const problems = globalProblems(globalManager({ ...opts, global: true }));\n if (problems.length === 0) {\n logOk(\"All global dependencies satisfied.\");\n return;\n }\n for (const line of problems) logErr(line);\n process.exit(1);\n }\n requireProjectConfig(opts.projectDir);\n // A mistyped key warns; a `harness:` nothing registers fails like a gap (p1474, p1022).\n const configErrors = await reportProjectConfig(path.resolve(opts.projectDir), {\n harness: true,\n instances: true,\n });\n const am = new AssetManager({\n registry: getKindRegistry(),\n projectDir: path.resolve(opts.projectDir),\n });\n const { gaps } = await am.projectState();\n const edited = await editedConventionFiles(path.resolve(opts.projectDir));\n // A skipped `mcp-server` or an unset required field fails nothing: a `!` line each.\n const notices = [\n ...(await am.mcpNotices()).map((n) => n.text),\n // A library that went back past the lock is no drift either (p1257).\n ...(await am.libraryOlderNotices()),\n // A lock written before it listed the instance files: the next write replaces them.\n ...am.legacyLockNotices(),\n ];\n // A store-origin ref the store could not be asked about is not \"satisfied\".\n await am.probeStoreOrigins();\n const notChecked = am.takeStoreNotChecked();\n const storeUnreachable = notChecked.some((n) => n.reason === \"unreachable\");\n if (gaps.length === 0 && edited.length === 0 && configErrors === 0 && !storeUnreachable) {\n logOk(\"All dependencies satisfied.\");\n for (const n of notices) logWarn(n);\n reportStoreNotCheckedForUpdates(notChecked);\n } else {\n for (const g of gaps) logErr(g.message);\n for (const e of edited) logErr(e);\n for (const n of notices) logWarn(n);\n reportStoreNotCheckedForUpdates(notChecked);\n process.exit(1);\n }\n });\n}\n\n/**\n * One message per convention file (SOUL.md, knowledge/, …) of a bound agent that was edited\n * after `skaile rebuild` pinned it: the compile manifest, not the file, is what the agent\n * runs from, so the edit never reaches it. Also one message per bound agent that `skaile run`\n * would refuse with `composition_rebuild_required` (an `inline-snapshot` item with no compile\n * pin, or a pin that is stale or malformed), in the words `run` prints (p1310). Instances bound\n * to the same agent directory share the files, so one message names every instance that runs\n * from them. A binding that resolves to no agent is a `projectState` gap, not reported here.\n * Shared by `check` and `doctor`.\n */\nexport async function editedConventionFiles(projectDir: string): Promise<string[]> {\n const instances = effectiveAgentInstances(resolveSkWorkspaceConfig(projectDir));\n const byDir = new Map<string, { ref: string; ids: string[]; instance: AgentInstanceConfig }>();\n for (const [id, instance] of Object.entries(instances)) {\n let agentDir: string | undefined;\n try {\n agentDir = resolveAgentDefinitionDir(projectDir, instance.ref);\n } catch (err) {\n if (err instanceof AgentRefResolutionError) continue;\n throw err;\n }\n if (!agentDir) continue;\n if (path.basename(agentDir) === \"agent.yaml\") agentDir = path.dirname(agentDir);\n const bound = byDir.get(agentDir);\n if (bound) bound.ids.push(id);\n else byDir.set(agentDir, { ref: instance.ref, ids: [id], instance });\n }\n const messages: string[] = [];\n for (const [agentDir, { ref, ids, instance }] of byDir) {\n const label = `${ids.length === 1 ? \"instance\" : \"instances\"} ${ids.join(\", \")}`;\n try {\n const drifted = await verifyConventionItems({\n agentDir,\n projectDir,\n registry: getKindRegistry(),\n });\n for (const err of drifted) messages.push(`${ref} (${label}): ${err.message}`);\n const manifest = await loadAgentManifest(agentDir);\n if (manifest) {\n await resolveAgentInstance({\n instanceId: ids[0]!,\n instance,\n asset: { manifest, dir: agentDir },\n projectDir,\n registry: getKindRegistry(),\n host: { nativeSubagents: true },\n dryRun: true,\n });\n }\n } catch (err) {\n if (!isCompositionError(err)) throw err;\n // Only the error `run` raises for a missing pin; other composition errors are not `check`'s.\n if (err.code === \"composition_rebuild_required\") {\n // A lock behind the library (a fresh clone after a persona bump): `rebuild` would fail\n // on it, so name `update` here, the same line `rebuild` and `install` give.\n const behind = await lockBehindLibraryErrors(agentDir, projectDir);\n if (behind.length > 0) {\n for (const e of behind) {\n messages.push(`${ref} (${label}): ${e.code}: ${e.message}`);\n }\n } else {\n messages.push(`${ref} (${label}): ${err.code}: ${err.message}`);\n }\n }\n }\n }\n return messages;\n}\n\n/**\n * Creates the `skaile clean` command.\n *\n * Removes all skaile-managed assets tracked in `skaile.lock.yaml` from the\n * workspace. With `--all` also removes history, patches, repos, and the lock\n * file itself. Preserves unmanaged (manually placed) assets.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-clean-command\n */\nexport function makeCleanCommand(): Command {\n return new Command(\"clean\")\n .description(\"Remove all skaile-managed assets from the workspace\")\n .option(\"--all\", \"Full reset: also remove history, patches, repos, and lock file\")\n .option(\"--dry-run\", \"Show what would be removed without doing it\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--target <agent>\", `Agent framework (${TARGET_DEFAULT_HINT})`)\n .option(\"--global\", \"Clean the global install (~/.skaile and every global harness)\")\n .option(\"--harness <ids>\", \"With --global: only these harnesses (comma-separated)\")\n .action(async (opts) => {\n const isGlobal = Boolean(opts.global || opts.harness);\n // A skaile.yaml that does not parse stops `clean` with one `✗` line (p910).\n if (!isGlobal) requireProjectConfig(opts.projectDir, { allowMissing: true });\n const am = isGlobal\n ? globalManager({ ...opts, global: true })\n : new AssetManager({\n registry: getKindRegistry(),\n projectDir: path.resolve(opts.projectDir),\n harness: opts.target as HarnessName,\n });\n\n // Preview: load lock file to show what will be cleaned\n const lock = readLock(\n isGlobal\n ? path.join(globalSkaileDir(), \"skaile.lock.yaml\")\n : path.resolve(opts.projectDir, \"skaile.lock.yaml\"),\n );\n\n if (!lock || Object.keys(lock.assets).length === 0) {\n logInfo(\"Nothing to clean (no skaile-managed assets found).\");\n return;\n }\n\n const assetRefs = Object.keys(lock.assets);\n console.log();\n console.log(` ${S.heading(\"Assets to remove:\")} ${S.dim(`(${assetRefs.length})`)}`);\n for (const ref of assetRefs) {\n console.log(` ${colorRef(ref)}`);\n }\n\n if (opts.all) {\n console.log();\n console.log(` ${S.heading(\"Also removing:\")}`);\n if (!isGlobal) {\n console.log(` ${S.dim(\".skaile/history.yaml\")}`);\n console.log(` ${S.dim(\".skaile/patches/\")}`);\n }\n console.log(` ${S.dim(isGlobal ? \"~/.skaile/skaile.lock.yaml\" : \"skaile.lock.yaml\")}`);\n }\n\n if (opts.dryRun) {\n console.log();\n logInfo(\"Dry run — no changes made.\");\n return;\n }\n\n if (!opts.yes) {\n const confirm = await p.confirm({ message: \"Proceed?\" });\n if (p.isCancel(confirm) || !confirm) {\n logInfo(\"Cancelled.\");\n return;\n }\n }\n\n const result = am.clean({ all: opts.all });\n\n console.log();\n for (const r of result.removed) {\n logOk(`Removed ${r}`);\n }\n for (const s of result.skipped) {\n logWarn(`Skipped ${s.ref}: ${s.reason}`);\n }\n if (result.unmanaged.length > 0) {\n console.log();\n logInfo(`Kept ${result.unmanaged.length} unmanaged asset(s):`);\n for (const u of result.unmanaged) {\n console.log(` ${S.dim(u)}`);\n }\n }\n if (opts.all) {\n console.log();\n logOk(\"Full reset complete.\");\n }\n });\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../cli/src/agent-pins.ts","../cli/src/commands/project.ts"],"names":["path","confirm"],"mappings":";;;;;;;;;;;;;;;;;AAmCA,SAAS,SAAS,QAAA,EAAgD;AAChE,EAAA,IAAI;AACF,IAAA,OAAO,SAAS,IAAA,CAAK,CAAC,SAAS,cAAA,CAAe,IAAI,MAAM,iBAAiB,CAAA;AAAA,EAC3E,CAAA,CAAA,MAAQ;AAEN,IAAA,OAAO,KAAA;AAAA,EACT;AACF;AASA,eAAsB,iBAAA,CACpB,UAAA,EACA,IAAA,GAA4B,EAAC,EACV;AACnB,EAAA,OAAA,CAAQ,MAAM,uBAAA,CAAwB,UAAA,EAAY,IAAI,CAAA,EAAG,MAAA;AAC3D;AAMA,SAAS,WAAA,CAAY,KAAuB,SAAA,EAA2B;AACrE,EAAA,IAAI,IAAI,KAAA,EAAO;AACb,IAAA,MAAM,IAAI,GAAA,CAAI,KAAA;AACd,IAAA,OAAO,CAAA,EAAG,CAAA,CAAE,GAAG,CAAA,WAAA,EAAc,CAAA,CAAE,OAAO,CAAA,QAAA,EAAW,CAAA,CAAE,cAAc,CAAA,SAAA,EAAY,CAAA,CAAE,aAAa,CAAA,yCAAA,CAAA;AAAA,EAC9F;AACA,EAAA,OAAO,CAAA,EAAG,IAAI,GAAA,IAAO,SAAS,WAAW,SAAS,CAAA,EAAA,EAAK,IAAI,OAAO,CAAA,CAAA,CAAA;AACpE;AASA,e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A;AACpB,QAAA;AAAA,MACF;AAAA,IACF;AAEA,IAAA,MAAM,SAAS,EAAA,CAAG,KAAA,CAAM,EAAE,GAAA,EAAK,IAAA,CAAK,KAAK,CAAA;AAEzC,IAAA,OAAA,CAAQ,GAAA,EAAI;AACZ,IAAA,KAAA,MAAW,CAAA,IAAK,OAAO,OAAA,EAAS;AAC9B,MAAA,KAAA,CAAM,CAAA,QAAA,EAAW,CAAC,CAAA,CAAE,CAAA;AAAA,IACtB;AACA,IAAA,KAAA,MAAW,CAAA,IAAK,OAAO,OAAA,EAAS;AAC9B,MAAA,OAAA,CAAQ,WAAW,CAAA,CAAE,GAAG,CAAA,EAAA,EAAK,CAAA,CAAE,MAAM,CAAA,CAAE,CAAA;AAAA,IACzC;AACA,IAAA,IAAI,MAAA,CAAO,SAAA,CAAU,MAAA,GAAS,CAAA,EAAG;AAC/B,MAAA,OAAA,CAAQ,GAAA,EAAI;AACZ,MAAA,OAAA,CAAQ,CAAA,KAAA,EAAQ,MAAA,CAAO,SAAA,CAAU,MAAM,CAAA,oBAAA,CAAsB,CAAA;AAC7D,MAAA,KAAA,MAAW,CAAA,IAAK,OAAO,SAAA,EAAW;AAChC,QAAA,OAAA,CAAQ,IAAI,CAAA,IAAA,EAAO,CAAA,CAAE,GAAA,CAAI,CAAC,CAAC,CAAA,CAAE,CAAA;AAAA,MAC/B;AAAA,IACF;AACA,IAAA,IAAI,KAAK,GAAA,EAAK;AACZ,MAAA,OAAA,CAAQ,GAAA,EAAI;AACZ,MAAA,KAAA,CAAM,sBAAsB,CAAA;AAAA,IAC9B;AAAA,EACF,CAAC,CAAA;AACL","file":"chunk-PLVM6OIV.js","sourcesContent":["/**\n * The compile pin of the agents `skaile add` keeps under `.skaile/cache/agents/<name>/`.\n *\n * An agent that composes an `inline-snapshot` item (a persona, a ruleset, …) runs from\n * `compile_manifest.json`, so it cannot run without one. `add`, `install` and `update` pin\n * such an agent themselves, once per lock revision: a pin that still matches the bytes the\n * lock serves (one `skaile rebuild` wrote, or an earlier add/install) is left alone, and\n * `skaile rebuild` only refreshes it. `update` also re-runs the rebuild for any\n * agent that holds a pin, a convention-only agent (SOUL.md) included, because the update\n * moved the bytes the pin hashes.\n */\n\nimport { existsSync, readdirSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { agentSourceCacheDir } from \"@skaile/workspaces/core\";\nimport {\n CompositionError,\n type CompositionContentSource,\n compileComposition,\n createCompositionContentSource,\n hashAgentFiles,\n isCompilePinCurrent,\n loadAgentManifest,\n loadCompileManifestFromDir,\n resolveBinding,\n} from \"@skaile/workspaces/runner\";\nimport { type AgentComposeItem, effectiveComposes } from \"@skaile/workspaces/types/manifests\";\nimport { logInfo, logWarn } from \"./helpers.ts\";\nimport { getKindRegistry } from \"./open-registry.ts\";\n\n/**\n * Whether `run` cannot start the agent without a compile pin: it declares an `inline-snapshot`\n * item (a persona, a ruleset bound so, ...). The convention files and the other bindings read\n * their source when no pin exists, so such an agent is left unpinned until `skaile rebuild`.\n */\nfunction needsPin(composes: readonly AgentComposeItem[]): boolean {\n try {\n return composes.some((item) => resolveBinding(item) === \"inline-snapshot\");\n } catch {\n // An item of a kind that has no binding: `run` and `rebuild` name it; nothing to pin here.\n return false;\n }\n}\n\n/**\n * Compile every cached agent of the project that declares an `inline-snapshot` composition item\n * and has no current pin. A compile that fails (an item no library or lock serves) is a warning\n * here: `skaile check` and `skaile run` raise the same error for the agent.\n *\n * @returns The names of the agents that were compiled.\n */\nexport async function pinComposedAgents(\n projectDir: string,\n opts: { repin?: boolean } = {},\n): Promise<string[]> {\n return (await pinComposedAgentsReport(projectDir, opts)).pinned;\n}\n\n/**\n * The `Missing:` line `install` prints for a composed asset the lock pins but no copy serves:\n * the same words as for a locked skill the library moved past (p1510).\n */\nfunction missingLine(err: CompositionError, agentName: string): string {\n if (err.moved) {\n const m = err.moved;\n return `${m.key} (library \"${m.library}\" is at ${m.libraryVersion}, locked ${m.lockedVersion}; \\`skaile update\\` moves the lock to it)`;\n }\n return `${err.ref ?? agentName} (agent ${agentName}: ${err.message})`;\n}\n\n/**\n * {@link pinComposedAgents}, plus the agents `run` could not start. An agent with no usable pin\n * whose locked persona or ruleset no library copy serves any more (the library moved on, or the\n * project is a fresh clone) is a `missing` line, not a warning: `install` exits 1 for it and\n * names `skaile update`, the only command that moves the lock (p1510). An agent that still has\n * its pin keeps running from it, so a library bump alone is silent.\n */\nexport async function pinComposedAgentsReport(\n projectDir: string,\n opts: { repin?: boolean } = {},\n): Promise<{ pinned: string[]; missing: string[] }> {\n const cacheDir = agentSourceCacheDir(projectDir);\n const pinned: string[] = [];\n const missing: string[] = [];\n if (!existsSync(cacheDir)) return { pinned, missing };\n for (const entry of readdirSync(cacheDir, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue;\n const agentDir = path.join(cacheDir, entry.name);\n const manifest = await loadAgentManifest(agentDir);\n if (!manifest) continue;\n const wanted = !!manifest.composes?.length && needsPin(manifest.composes);\n // `update` re-runs the rebuild for an agent that was pinned: the pin hashes bytes it moved.\n if (!wanted && !(opts.repin && (await hasCompilePin(agentDir)))) continue;\n const composes = manifest.composes ?? [];\n let items: AgentComposeItem[] = [];\n const source = createCompositionContentSource({\n agentDir,\n projectDir,\n registry: getKindRegistry(),\n });\n try {\n const files = await hashAgentFiles(agentDir);\n items = effectiveComposes(\n composes,\n files.map((f) => f.path),\n );\n if (await isCompilePinCurrent({ agentDir, items, source })) continue;\n const result = await compileComposition({ agentDir, items, source });\n pinned.push(entry.name);\n logInfo(\n `Compiled agent ${manifest.name ?? entry.name} (${result.resolvedCount} composition items) → prompt v${result.manifest.prompt_version}`,\n );\n } catch (err) {\n if (err instanceof CompositionError && err.code === \"composition_asset_missing\") {\n // The bytes the lock pins are gone, but the pin that was compiled from them still\n // serves `run`: nothing for install to report.\n if (await hasCompilePin(agentDir)) continue;\n for (const line of await missingLines(items, source, err, entry.name)) {\n if (!missing.includes(line)) missing.push(line);\n }\n continue;\n }\n const reason = err instanceof Error ? err.message : String(err);\n const code = err && typeof err === \"object\" && \"code\" in err ? `${String(err.code)}: ` : \"\";\n logWarn(`Could not compile agent ${entry.name}: ${code}${reason}`);\n }\n }\n return { pinned, missing };\n}\n\n/** Whether the agent folder holds a readable compile pin. */\nasync function hasCompilePin(agentDir: string): Promise<boolean> {\n try {\n return (await loadCompileManifestFromDir(agentDir)) !== undefined;\n } catch {\n return false;\n }\n}\n\n/** One line per item the source cannot serve (the compile names only the first). */\nasync function missingLines(\n items: readonly AgentComposeItem[],\n source: CompositionContentSource,\n first: CompositionError,\n agentName: string,\n): Promise<string[]> {\n const lines = [missingLine(first, agentName)];\n for (const item of items) {\n try {\n await source.load(item.ref, item.kind);\n } catch (err) {\n if (err instanceof CompositionError && err.code === \"composition_asset_missing\") {\n lines.push(missingLine(err, agentName));\n }\n }\n }\n return [...new Set(lines)];\n}\n\n/**\n * The items of the agent that a rebuild could not serve because a registered library moved past\n * the version the lock pins: each error names `skaile update`, the command that moves the lock.\n * `check` prints these instead of sending the user to a `skaile rebuild` that would fail with\n * the same lines. Empty when a rebuild can read every item.\n */\nexport async function lockBehindLibraryErrors(\n agentDir: string,\n projectDir: string,\n): Promise<CompositionError[]> {\n const manifest = await loadAgentManifest(agentDir);\n if (!manifest) return [];\n const files = await hashAgentFiles(agentDir);\n const items = effectiveComposes(\n manifest.composes,\n files.map((f) => f.path),\n );\n const source = createCompositionContentSource({\n agentDir,\n projectDir,\n registry: getKindRegistry(),\n });\n const out: CompositionError[] = [];\n for (const item of items) {\n try {\n await source.load(item.ref, item.kind);\n } catch (err) {\n if (\n err instanceof CompositionError &&\n err.code === \"composition_asset_missing\" &&\n err.moved\n ) {\n out.push(err);\n }\n }\n }\n return out;\n}\n","import { homedir } from \"node:os\";\nimport path from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport {\n AssetManager,\n type ContentHeld,\n type InstalledAgentInstance,\n type LibraryMove,\n type ReplacedAsset,\n type RewrittenAgent,\n} from \"@skaile/workspaces/asset-manager\";\nimport {\n type AgentInstanceConfig,\n AgentRefResolutionError,\n type HarnessName,\n effectiveAgentInstances,\n globalSkaileDir,\n type PresetExpansion,\n parseAssetRef,\n readLock,\n resolveAgentDefinitionDir,\n resolveSkWorkspaceConfig,\n SourceEntryError,\n userConfigPath,\n} from \"@skaile/workspaces/core\";\nimport {\n isCompositionError,\n loadAgentManifest,\n resolveAgentInstance,\n verifyConventionItems,\n} from \"@skaile/workspaces/runner\";\nimport type { InstallManifest } from \"@skaile/workspaces/types\";\nimport { Command } from \"commander\";\nimport {\n colorRef,\n requireProjectConfig,\n formatSoftDepHint,\n deferredWarnings,\n logErr,\n logInfo,\n logOk,\n logWarn,\n parseHarnessFilter,\n reportLegacyOmpCopies,\n S,\n TARGET_DEFAULT_HINT,\n warnFilesOnlyDelegates,\n warnStaleHarnessCopies,\n warnPlaceholderBodies,\n} from \"../helpers.ts\";\nimport {\n agentInstanceErrorLines,\n agentInstanceWarningLines,\n reportProjectConfig,\n reportUnknownHarnesses,\n} from \"../config-checks.ts\";\nimport { createSpinner } from \"../spinner.ts\";\nimport { getKindRegistry } from \"../open-registry.ts\";\nimport { lockBehindLibraryErrors, pinComposedAgentsReport } from \"../agent-pins.ts\";\n\n/**\n * Canonical asset-ref shape accepted by `skaile install <ref>`:\n * `kind:@<publisher>/<name>#<version>` (the `#` version sigil). Validated via\n * `parseAssetRef` so the CLI shares the single canonical grammar; the legacy\n * trailing-`@version` shape is rejected.\n */\nexport const REF_HINT = \"kind:@<publisher>/<name>#<version> (e.g. skill:@skaile-ai/use-exa#1.0.0)\";\n\n/** True when `ref` parses as a canonical asset ref. */\nfunction isValidAssetRef(ref: string): boolean {\n try {\n parseAssetRef(ref);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Minimal catalog-source surface the pointer-only install path needs.\n * `RemoteCatalogSource` satisfies this — narrowing keeps {@link runPointerOnlyInstall}\n * testable with a hand-rolled stub.\n */\nexport interface InstallManifestSource {\n getInstallManifest(ref: string): Promise<InstallManifest>;\n}\n\n/**\n * Capability check: is this catalog source able to serve install manifests?\n *\n * `openCatalogSource` returns a `RemoteCatalogSource | RestCatalogSource`.\n * Only the tRPC-framed `RemoteCatalogSource` implements `getInstallManifest`;\n * the REST-framed `RestCatalogSource` (the default for any catalog URL other\n * than `https://skaile.store`) does not. Calling it unconditionally would be a\n * runtime `TypeError`, so the pointer-only install path must capability-detect\n * first and fail with a clear, actionable message.\n */\nexport function supportsInstallManifest(source: unknown): source is InstallManifestSource {\n return (\n typeof (source as { getInstallManifest?: unknown } | null | undefined)?.getInstallManifest ===\n \"function\"\n );\n}\n\n/**\n * Minimal library surface the pointer-only install path needs.\n * `LocalIndex` satisfies this.\n */\nexport interface InstallLibrary {\n install(manifest: InstallManifest): Promise<{ installPath: string }>;\n}\n\n/**\n * Result of a pointer-only catalog install.\n */\nexport interface PointerOnlyInstallResult {\n /** Absolute path the verified asset bytes were written to. */\n installPath: string;\n /** The pinned upstream commit SHA the asset was fetched at. */\n commitSha: string;\n /** Number of files in the install manifest. */\n fileCount: number;\n}\n\n/**\n * Pointer-only catalog install — the `skaile install <ref>` code path.\n *\n * 1. Resolves the pointer-only {@link InstallManifest} from the Catalog.\n * 2. Hands it to the library, which fetches each file's bytes directly from\n * the upstream repo at the pinned commit, verifies every per-file SHA256\n * plus the composite SHA256, and only then writes the verified files.\n *\n * Both dependencies are injected so the function is unit-testable without a\n * network round-trip. In production the CLI passes a `RemoteCatalogSource`\n * and a `LocalIndex`.\n *\n * @param ref - Canonical asset ref (`kind:@<publisher>/<name>#<version>`).\n * @param deps - Injected catalog source + library.\n * @returns The install path, pinned commit SHA, and file count.\n * @throws When the ref is malformed, the manifest cannot be resolved, or any\n * hash verification fails. The underlying error message is surfaced as-is.\n */\nexport async function runPointerOnlyInstall(\n ref: string,\n deps: { catalog: InstallManifestSource; library: InstallLibrary },\n): Promise<PointerOnlyInstallResult> {\n let requested: ReturnType<typeof parseAssetRef>;\n try {\n requested = parseAssetRef(ref);\n } catch (e) {\n throw new Error(\n `malformed asset ref '${ref}' — expected ${REF_HINT}: ${e instanceof Error ? e.message : String(e)}`,\n );\n }\n const manifest = await deps.catalog.getInstallManifest(ref);\n // [M1] Identity check: the catalog must not install a different asset than\n // requested. Compare the PARSED refs (kind/publisher/name/pin) so equivalent\n // spellings (optional `kind:`, default `skill`) are treated as the same ref.\n const got = parseAssetRef(manifest.ref);\n if (\n got.kind !== requested.kind ||\n got.publisher !== requested.publisher ||\n got.name !== requested.name ||\n got.pin !== requested.pin\n ) {\n throw new Error(\n `catalog identity mismatch: requested '${ref}' but the catalog returned a manifest for '${manifest.ref}'`,\n );\n }\n const { installPath } = await deps.library.install(manifest);\n return {\n installPath,\n commitSha: manifest.source.commitSha,\n fileCount: manifest.files.length,\n };\n}\n\n/**\n * Print one summary line per `preset:` dependency `skaile install` expanded: how many\n * asset items joined the install set and how many instance items (`library://`,\n * placeholders) were skipped, which only `skaile preset apply` materialises.\n */\nexport function reportPresetExpansions(\n presets: readonly PresetExpansion[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const preset of presets ?? []) {\n onLine(\n `preset ${preset.ref}: ${preset.assets} assets, ${preset.skipped} instance items skipped (apply with skaile preset apply)`,\n );\n }\n}\n\n/**\n * Print one line per agent instance `skaile install` rendered (with the files\n * written) and one per native agent file removed because its instance left `skaile.yaml`.\n */\nexport function reportAgentInstances(\n instances: readonly InstalledAgentInstance[] | undefined,\n removedFiles: readonly string[] | undefined,\n onLine: (line: string) => void = logInfo,\n onRemoved: (line: string) => void = logWarn,\n): void {\n for (const instance of instances ?? []) {\n onLine(`agent ${instance.id}: ${instance.files.join(\", \")}`);\n }\n for (const file of removedFiles ?? []) onRemoved(`Removed: ${file}`);\n}\n\n/** One `Re-locked` line per lock entry `install`/`update` rewrote for an already-locked asset. */\nexport function reportRelocked(\n relocked: string[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const ref of relocked ?? []) onLine(`Re-locked ${ref}`);\n}\n\n/**\n * One line per locked library asset whose library holds the locked version with other bytes.\n * `install` keeps the lock and the deployed copy; only `update` takes the edit (OQ13, p1911).\n * The project does not match its library, as `check` says, so the run exits 1.\n */\nexport function reportContentHeld(\n held: ContentHeld[] | undefined,\n onLine: (line: string) => void = logWarn,\n): void {\n for (const h of held ?? []) {\n onLine(\n `${h.ref.split(\"#\")[0]}: library \"${h.library}\" changed since lock (same version ${h.version}). Run ${S.cmd(\"skaile update\")} to take the change.`,\n );\n process.exitCode = 1;\n }\n}\n\n/** One line per global entry `install --global` limited to the one harness that holds its copy (p1442). */\nexport function reportInferredHarnesses(\n inferred: readonly { ref: string; harnesses: readonly string[] }[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const i of inferred ?? []) {\n onLine(\n `${i.ref} stays on ${i.harnesses.join(\", \")} (its only copy); add it to another harness with \\`skaile add ${i.ref} --global --harness <id>\\``,\n );\n }\n}\n\n/** One `! <ref> moved from <a> to <b>` line per locked asset that now resolves from another library. */\nexport function reportMoved(\n moved: readonly LibraryMove[] | undefined,\n onLine: (line: string) => void = logWarn,\n): void {\n for (const m of moved ?? []) onLine(`${m.ref} moved from ${m.from} to ${m.to}`);\n}\n\n/** One `replaced <old> → <new>` line per asset `install`/`update` moved to another locked version. */\nexport function reportReplaced(\n replaced: readonly ReplacedAsset[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const r of replaced ?? []) onLine(`${r.ref} replaced ${r.from} → ${r.to}`);\n}\n\n/** One `Rewrote <file> (agent render changed)` line per rendered agent file whose bytes the CLI's render changed. */\nexport function reportRewritten(\n rewritten: readonly RewrittenAgent[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const r of rewritten ?? []) {\n for (const f of r.files) onLine(`Rewrote ${f} (agent render changed)`);\n }\n}\n\n/**\n * Say which locked store assets `install`/`update` did not check against the store (p792,\n * p799). A chosen mode (air-gapped, `--no-catalog`) is one info line per asset; a store that\n * did not answer is an error line `store unreachable: could not check <ref> for updates`.\n *\n * @returns Whether any asset could not be checked because the store was unreachable: the\n * command then ends `Failed` with exit 1.\n */\nexport function reportStoreNotChecked(\n notChecked: readonly { ref: string; reason: string; detail: string }[] | undefined,\n): boolean {\n let unreachable = false;\n for (const n of notChecked ?? []) {\n if (n.reason === \"unreachable\") {\n unreachable = true;\n logErr(`store unreachable: could not check ${n.ref} for updates (${n.detail})`);\n } else if (n.reason === \"air-gapped\") {\n logInfo(`${n.ref} kept as locked (air-gapped: not checked against the store)`);\n } else {\n logInfo(`${n.ref} kept as locked (${n.detail})`);\n }\n }\n return unreachable;\n}\n\n/**\n * Say which refs `outdated`, `check` or `doctor` could not check against the store\n * (`AssetManager.takeStoreNotChecked`). A store that did not answer is one error\n * line per ref (`store unreachable: <ref> not checked (<why>)`); an air-gapped client\n * (`catalog.cache_ttl: 0`) chose not to ask, so its refs are one info line each.\n *\n * @returns Whether any ref was not checked because the store was unreachable: the command then\n * exits 1, as `install` and `update` do.\n */\nexport function reportStoreNotCheckedForUpdates(\n notChecked: readonly { ref: string; reason: string; detail: string }[],\n): boolean {\n let unreachable = false;\n for (const n of notChecked) {\n if (n.reason === \"air-gapped\") {\n logInfo(`${n.ref} not checked (air-gapped: the store was not asked)`);\n } else {\n unreachable = true;\n logErr(`store unreachable: ${n.ref} not checked (${n.detail})`);\n }\n }\n return unreachable;\n}\n\n/**\n * Creates the `skaile install` command.\n *\n * Two modes, selected by argument shape:\n *\n * - `skaile install` (no positional arg) — reads `skaile.yaml` and deploys all\n * declared assets (and their transitive dependencies) to the configured\n * harness target directory. Supports `--locked` for CI-mode install from a\n * lock file.\n * - `skaile install kind:@<publisher>/<name>#<version>` — pointer-only catalog\n * install: resolves the pointer-only install manifest from the configured\n * Catalog, fetches each file's bytes directly from the upstream repo at the\n * pinned commit, verifies every per-file + the composite SHA256, then writes\n * the verified files into the local Library.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-install-command\n */\nexport function makeInstallCommand(): Command {\n return new Command(\"install\")\n .description(`Install dependencies from skaile.yaml, or a single asset by ref (${REF_HINT})`)\n .argument(\"[ref]\", `Asset ref to install from the Catalog (${REF_HINT})`)\n .option(\"--locked\", \"Install from lock file (CI mode — fails on drift)\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--target <agent>\", `Agent framework (${TARGET_DEFAULT_HINT})`)\n .option(\n \"--global\",\n \"Install the global SSOT (~/.skaile/skaile.yaml), fanning out to every global harness\",\n )\n .option(\n \"--harness <ids>\",\n \"Comma-separated global harnesses to install into (default: all resolved); implies --global\",\n )\n .option(\n \"--link\",\n \"symlink local-path assets instead of copying (dev loop; machine-local, not for committing)\",\n )\n .option(\n \"--force\",\n \"Deploy over a folder no lock entry owns (a hand-made skill of the same name), and prune an undeclared asset whose folder holds your edits, instead of refusing\",\n )\n .option(\n \"--verbose\",\n \"also print the resolver's searched directories for an agent it cannot find\",\n )\n .action(runInstallCommand);\n}\n\n/** Options shape accepted by the `skaile install` command action. */\nexport interface InstallCommandOptions {\n locked?: boolean;\n projectDir: string;\n target?: string;\n global?: boolean;\n harness?: string;\n link?: boolean;\n force?: boolean;\n verbose?: boolean;\n}\n\n/**\n * `skaile install` action body. Dispatches by argument shape:\n * a positional `ref` selects pointer-only catalog install, otherwise the\n * legacy `skaile.yaml` install path runs.\n */\nasync function runInstallCommand(\n ref: string | undefined,\n opts: InstallCommandOptions,\n): Promise<void> {\n // ── Pointer-only catalog install: `skaile install <ref>` ──────────────\n if (ref !== undefined) {\n await runRefInstall(ref, opts);\n return;\n }\n\n // ── Legacy install: `skaile install` reads skaile.yaml ────────────────\n await runYamlInstall(opts);\n}\n\n/** Pointer-only catalog install path for `skaile install <ref>`. */\nasync function runRefInstall(ref: string, opts: InstallCommandOptions): Promise<void> {\n if (!isValidAssetRef(ref)) {\n logErr(`malformed asset ref '${ref}' — expected ${REF_HINT}`);\n process.exit(1);\n }\n // The store installs one exact version; without `#<version>` it answers a bare 400, so say\n // what is missing before the call.\n if (!parseAssetRef(ref).pin) {\n logErr(\n `${ref} needs a version: use ${ref}#<version>. A library asset is deployed with \\`skaile add ${ref}\\`, not \\`skaile install\\`.`,\n );\n process.exit(1);\n }\n const spinner = createSpinner();\n spinner.start(`Installing ${ref}`);\n try {\n const { openCatalogSource, openLibrary } = await import(\"../open-library.ts\");\n const catalog = await openCatalogSource({ projectDir: path.resolve(opts.projectDir) });\n // [H2] REST-framed catalogs (the default for any catalog URL other\n // than https://skaile.store) cannot serve install manifests. Detect\n // and fail clearly rather than throwing a runtime TypeError.\n if (!supportsInstallManifest(catalog)) {\n throw new Error(\n \"pointer-only install (skaile install <ref>) requires a tRPC-framed Catalog. \" +\n \"The configured catalog uses REST framing, which does not serve install \" +\n \"manifests. Set catalog.url to https://skaile.store, or catalog.framing: trpc, \" +\n `in ${userConfigPath()}.`,\n );\n }\n const library = await openLibrary();\n try {\n const result = await runPointerOnlyInstall(ref, { catalog, library });\n spinner.stop(\"Done\");\n logOk(`Installed ${colorRef(ref)}`);\n logInfo(`Path: ${S.dim(result.installPath)}`);\n logInfo(`Commit: ${S.dim(result.commitSha)}`);\n logInfo(`Files: ${S.dim(String(result.fileCount))}`);\n logInfo(\n S.dim(\n `Installed globally (see Path above) — use \\`skaile add ${ref}\\` to deploy into this project.`,\n ),\n );\n } finally {\n library.close();\n }\n } catch (err) {\n spinner.stop(\"Failed\");\n const msg = err instanceof Error ? err.message : String(err);\n if (/failed: 404\\b/.test(msg)) {\n logErr(\n `${ref} is not in the store. For a library asset use \\`skaile add ${ref.replace(/#.*$/, \"\")}\\`.`,\n );\n } else if (/unreachable/i.test(msg)) {\n logErr(`asset uninstallable — source commit no longer available (${msg})`);\n } else {\n logErr(msg);\n }\n process.exit(1);\n }\n}\n\n/** Legacy install path for bare `skaile install` (reads skaile.yaml). Also runs `skaile harness set`. */\nexport async function runYamlInstall(opts: InstallCommandOptions): Promise<void> {\n const projectDir = path.resolve(opts.projectDir);\n\n const harnesses = parseHarnessFilter(opts.harness);\n // `--harness` implies `--global`.\n if (opts.global || harnesses) {\n await runGlobalInstall(opts, harnesses);\n return;\n }\n\n // A project without a readable skaile.yaml stops here, before sources are cloned, assets\n // are deployed or undeployed, or the lock is written.\n requireProjectConfig(projectDir);\n\n // Refuse what `validate` rejects for the `agents:` map, before anything is written (p1512);\n // a key of `agent:` or `agents:` that nothing reads warns (p1712).\n for (const line of agentInstanceWarningLines(projectDir)) logWarn(line);\n const instanceErrors = agentInstanceErrorLines(projectDir);\n if (instanceErrors.length > 0) {\n for (const line of instanceErrors) logErr(line);\n process.exit(1);\n }\n // A `harness:` nothing registers fails as in `validate` and `check` (p1754).\n if ((await reportUnknownHarnesses(projectDir)) > 0) process.exit(1);\n\n // Hydrate sources declared in skaile.yaml before resolving assets, so\n // freshly checked-out projects pull their source clones automatically.\n try {\n const { ensureSourcesCloned } = await import(\"../ensure-sources.ts\");\n const hydrate = ensureSourcesCloned(projectDir, { quiet: true });\n if (hydrate.cloned.length > 0) {\n logOk(`Cloned source(s): ${hydrate.cloned.join(\", \")}`);\n }\n if (hydrate.failed.length > 0) {\n logErr(`Failed to clone source(s): ${hydrate.failed.join(\", \")}`);\n }\n } catch (err) {\n logWarn(`source hydration skipped: ${err instanceof Error ? err.message : String(err)}`);\n }\n\n const warnings = deferredWarnings();\n const am = new AssetManager({\n registry: getKindRegistry(),\n projectDir,\n harness: opts.target as HarnessName,\n onLibraryCollision: warnings.push,\n });\n const spinner = createSpinner();\n spinner.start(opts.locked ? \"Installing from lock file\" : \"Installing dependencies\");\n try {\n const result = await am.install({ locked: opts.locked, link: opts.link, force: opts.force });\n const storeUnreachable = result.storeNotChecked?.some((n) => n.reason === \"unreachable\");\n spinner.stop(\n result.agentInstanceErrors?.length ||\n result.missing.length > 0 ||\n storeUnreachable ||\n result.contentHeld?.length\n ? \"Failed\"\n : \"Done\",\n );\n warnings.flush();\n if (result.deployed.length > 0) {\n for (const d of result.deployed) logOk(d);\n }\n warnPlaceholderBodies(result.placeholderBodies, result.placeholderDescriptions);\n for (const r of result.restored ?? []) {\n for (const f of r.restored) logInfo(`Restored ${f}`);\n for (const f of r.removed) logInfo(`Removed ${f} (not part of ${r.ref})`);\n }\n reportRewritten(result.rewritten);\n for (const line of result.libraryNotices ?? []) logInfo(line);\n reportPresetExpansions(result.presets);\n reportAgentInstances(result.agentInstances, result.agentFilesRemoved);\n // Said when this install wrote an agent file (a fresh clone, a changed agent), not when it only\n // restored a skill or did nothing (p1673).\n if (\n result.deployed.some((d) => d.startsWith(\"agent:\")) ||\n result.replaced?.some((r) => r.ref.startsWith(\"agent:\")) ||\n result.agentInstancesChanged?.length\n ) {\n warnFilesOnlyDelegates(am.projectDir, am.harness);\n }\n if (result.removed.length > 0) {\n for (const r of result.removed) logWarn(`Removed: ${r}`);\n }\n reportReplaced(result.replaced);\n reportRelocked(result.relocked);\n reportMoved(result.moved);\n reportContentHeld(result.contentHeld);\n const pins = await pinComposedAgentsReport(projectDir);\n const missing = [...result.missing, ...pins.missing];\n if (\n result.deployed.length === 0 &&\n result.removed.length === 0 &&\n !result.replaced?.length &&\n missing.length === 0 &&\n !result.storeNotChecked?.length &&\n !result.restored?.length &&\n !result.relocked?.length &&\n !result.contentHeld?.length &&\n !result.moved?.length &&\n !result.agentInstanceErrors?.length\n ) {\n logInfo(\"Nothing to install (already up to date).\");\n }\n if (result.agentInstanceErrors?.length) {\n if (opts.verbose) for (const d of result.agentInstanceDetails ?? []) logInfo(S.dim(d));\n logErr(\n `${result.agentInstanceErrors.length} agent instance(s) could not be rendered (see above)`,\n );\n process.exitCode = 1;\n }\n if (missing.length > 0) {\n for (const m of missing) logErr(`Missing: ${m}${result.missingHints?.[m] ?? \"\"}`);\n // Partial-miss must fail the process — CI can't otherwise distinguish a\n // clean install from \"half the assets never resolved\".\n process.exitCode = 1;\n }\n if (reportStoreNotChecked(result.storeNotChecked)) process.exitCode = 1;\n // A ref that only resolved once the assets were installed (a catalog agent) is checked now.\n const lateInstanceErrors = agentInstanceErrorLines(projectDir);\n for (const line of lateInstanceErrors) logErr(line);\n if (lateInstanceErrors.length > 0) process.exitCode = 1;\n if (result.lockWritten) {\n logInfo(`Lock file written: ${S.dim(\"skaile.lock.yaml\")}`);\n }\n warnStaleHarnessCopies(am);\n // Report-only: surface soft deps the declared assets reference but aren't\n // present. Never a prompt — install is a batch/CI path. Skipped under\n // --locked: that mode is \"restore exactly\", so an `add` nudge would jar.\n if (!opts.locked) await reportInstalledSoftDeps(am);\n } catch (err) {\n spinner.stop(\"Failed\");\n logErr(err instanceof SourceEntryError ? err.message : String(err));\n process.exit(1);\n }\n}\n\n/**\n * Report (never prompt) the body-link soft deps that the declared assets\n * reference but that aren't in the project — the `install` counterpart to the\n * `add`-time soft-dep surface. `install` is a batch/CI path (often non-TTY), so\n * it only ever prints a hint: pulling stays an explicit `skaile add`. Best-effort\n * — `reportSoftDeps` swallows any index failure and returns `[]`.\n */\nexport async function reportInstalledSoftDeps(\n am: Pick<AssetManager, \"listDeclared\" | \"reportSoftDeps\">,\n onHint: (line: string) => void = (l) => logInfo(S.dim(l)),\n): Promise<void> {\n try {\n const declared = (await am.listDeclared()).map((d) => d.ref);\n if (declared.length === 0) return;\n const edges = await am.reportSoftDeps(declared);\n for (const edge of edges) onHint(formatSoftDepHint(edge));\n } catch {\n // Best-effort: a soft-dep report must never fail an install that succeeded.\n }\n}\n\n/**\n * Global cross-harness install: deploy every dep declared in the global SSOT\n * (`~/.skaile/skaile.yaml`) into each resolved global harness's dir under `~`,\n * write the global lock (`~/.skaile/skaile.lock.yaml`), then print per-harness\n * state. `harnesses` is the `--harness` filter (omit for the full resolved set).\n */\nasync function runGlobalInstall(\n opts: InstallCommandOptions,\n harnesses: HarnessName[] | undefined,\n): Promise<void> {\n const am = new AssetManager({\n registry: getKindRegistry(),\n projectDir: path.resolve(opts.projectDir),\n global: true,\n harnesses,\n });\n const spinner = createSpinner();\n spinner.start(\"Installing global dependencies\");\n try {\n const result = await am.install({ locked: opts.locked, link: opts.link, force: opts.force });\n const storeUnreachable = result.storeNotChecked?.some((n) => n.reason === \"unreachable\");\n spinner.stop(\n result.missing.length > 0 || storeUnreachable || result.contentHeld?.length\n ? \"Failed\"\n : \"Done\",\n );\n if (result.deployed.length > 0) for (const d of result.deployed) logOk(d);\n warnPlaceholderBodies(result.placeholderBodies, result.placeholderDescriptions);\n reportPresetExpansions(result.presets);\n if (result.removed.length > 0) for (const r of result.removed) logWarn(`Removed: ${r}`);\n reportReplaced(result.replaced);\n reportRelocked(result.relocked);\n reportInferredHarnesses(result.inferredHarnesses);\n reportMoved(result.moved);\n reportContentHeld(result.contentHeld);\n if (\n result.deployed.length === 0 &&\n result.removed.length === 0 &&\n !result.replaced?.length &&\n result.missing.length === 0 &&\n !result.storeNotChecked?.length &&\n !result.relocked?.length &&\n !result.contentHeld?.length &&\n !result.moved?.length\n )\n logInfo(\"Nothing to install (already up to date).\");\n if (reportStoreNotChecked(result.storeNotChecked)) process.exitCode = 1;\n if (result.missing.length > 0) {\n for (const m of result.missing) logErr(`Missing: ${m}${result.missingHints?.[m] ?? \"\"}`);\n process.exitCode = 1;\n }\n if (result.lockWritten) logInfo(`Global lock written: ${S.dim(\"~/.skaile/skaile.lock.yaml\")}`);\n reportLegacyOmpCopies(am.takeLegacyCopiesRemoved(), am.takeLegacyCopiesKept());\n\n // Per-harness reconciliation summary so a partial fan-out is visible.\n const state = am.globalState({});\n const byHarness = new Map<string, number>();\n for (const s of state)\n if (s.state === \"installed\") byHarness.set(s.harness, (byHarness.get(s.harness) ?? 0) + 1);\n for (const [harness, n] of byHarness) logInfo(`${harness}: ${n} installed`);\n } catch (err) {\n spinner.stop(\"Failed\");\n logErr(String(err));\n process.exit(1);\n }\n}\n\n/** The `--global` options of `check`, `doctor` and `clean`. */\ninterface GlobalScopeOptions {\n global?: boolean;\n harness?: string;\n projectDir: string;\n}\n\n/** A manager over the user-scope SSOT (`~/.skaile`), limited to `--harness` when given. */\nfunction globalManager(opts: GlobalScopeOptions): AssetManager {\n return new AssetManager({\n registry: getKindRegistry(),\n projectDir: path.resolve(opts.projectDir),\n global: true,\n harnesses: parseHarnessFilter(opts.harness),\n });\n}\n\n/**\n * What is wrong with the global install: one line per declared asset a harness does not hold\n * (`list --global` calls these `declared` and `drift`), per invalid entry, and per old\n * `~/.omp/<dir>` copy a 5.12.0 install left behind. Empty when the global state is clean (p911).\n */\nexport function globalProblems(am: AssetManager): string[] {\n const lines = new Set<string>();\n for (const row of am.globalState({})) {\n if (row.state === \"declared\") {\n lines.add(\n `${row.ref} is declared in ~/.skaile/skaile.yaml but not installed: run skaile install --global`,\n );\n } else if (row.state === \"drift\") {\n lines.add(\n `${row.ref} is missing from ${row.harness}: run skaile install --global --harness ${row.harness}`,\n );\n } else if (row.state === \"invalid\") {\n lines.add(`${row.ref} in ~/.skaile/skaile.yaml is not a valid asset ref`);\n }\n }\n for (const stale of am.staleLegacyOmpCopies()) {\n lines.add(\n `${stale.path.replace(homedir(), \"~\")} is an old omp copy of ${stale.ref} (omp reads ~/.omp/agent): run skaile install --global --harness omp, or delete it`,\n );\n }\n return [...lines];\n}\n\n/**\n * Creates the `skaile check` command.\n *\n * Fails (exit 1) on every problem {@link AssetManager.projectState} reports: unmet\n * requirements of deployed assets, a declared dep that never resolved into the lock (its\n * library or source is gone, like `skaile list` showing it as `declared`) or never\n * materialized (e.g. a store-sourced `mcp-server`, #462), a locked asset whose library is\n * gone or whose deployed copy or files are missing, a locked library asset whose files\n * changed since the lock (or whose lock hash predates the shared asset hash), and an\n * `agents.<id>.ref` that binds to no agent. `doctor`, `outdated`, `diff` and\n * `install --locked` take their verdict from the same state.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-check-command\n */\nexport function makeCheckCommand(): Command {\n return new Command(\"check\")\n .description(\"Check for unmet requirements\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--global\", \"Check the global install (~/.skaile) instead of the project\")\n .option(\"--harness <ids>\", \"With --global: only these harnesses (comma-separated)\")\n .action(async (opts) => {\n if (opts.global || opts.harness) {\n const problems = globalProblems(globalManager({ ...opts, global: true }));\n if (problems.length === 0) {\n logOk(\"All global dependencies satisfied.\");\n return;\n }\n for (const line of problems) logErr(line);\n process.exit(1);\n }\n requireProjectConfig(opts.projectDir);\n // A mistyped key warns; a `harness:` nothing registers fails like a gap (p1474, p1022).\n const configErrors = await reportProjectConfig(path.resolve(opts.projectDir), {\n harness: true,\n instances: true,\n });\n const am = new AssetManager({\n registry: getKindRegistry(),\n projectDir: path.resolve(opts.projectDir),\n });\n const { gaps } = await am.projectState();\n const edited = await editedConventionFiles(path.resolve(opts.projectDir));\n // A skipped `mcp-server` or an unset required field fails nothing: a `!` line each.\n const notices = [\n ...(await am.mcpNotices()).map((n) => n.text),\n // A library that went back past the lock is no drift either (p1257).\n ...(await am.libraryOlderNotices()),\n // A lock written before it listed the instance files: the next write replaces them.\n ...am.legacyLockNotices(),\n ];\n // A store-origin ref the store could not be asked about is not \"satisfied\".\n await am.probeStoreOrigins();\n const notChecked = am.takeStoreNotChecked();\n const storeUnreachable = notChecked.some((n) => n.reason === \"unreachable\");\n if (gaps.length === 0 && edited.length === 0 && configErrors === 0 && !storeUnreachable) {\n logOk(\"All dependencies satisfied.\");\n for (const n of notices) logWarn(n);\n reportStoreNotCheckedForUpdates(notChecked);\n } else {\n for (const g of gaps) logErr(g.message);\n for (const e of edited) logErr(e);\n for (const n of notices) logWarn(n);\n reportStoreNotCheckedForUpdates(notChecked);\n process.exit(1);\n }\n });\n}\n\n/**\n * One message per convention file (SOUL.md, knowledge/, …) of a bound agent that was edited\n * after `skaile rebuild` pinned it: the compile manifest, not the file, is what the agent\n * runs from, so the edit never reaches it. Also one message per bound agent that `skaile run`\n * would refuse with `composition_rebuild_required` (an `inline-snapshot` item with no compile\n * pin, or a pin that is stale or malformed), in the words `run` prints (p1310). Instances bound\n * to the same agent directory share the files, so one message names every instance that runs\n * from them. A binding that resolves to no agent is a `projectState` gap, not reported here.\n * Shared by `check` and `doctor`.\n */\nexport async function editedConventionFiles(projectDir: string): Promise<string[]> {\n const instances = effectiveAgentInstances(resolveSkWorkspaceConfig(projectDir));\n const byDir = new Map<string, { ref: string; ids: string[]; instance: AgentInstanceConfig }>();\n for (const [id, instance] of Object.entries(instances)) {\n let agentDir: string | undefined;\n try {\n agentDir = resolveAgentDefinitionDir(projectDir, instance.ref);\n } catch (err) {\n if (err instanceof AgentRefResolutionError) continue;\n throw err;\n }\n if (!agentDir) continue;\n if (path.basename(agentDir) === \"agent.yaml\") agentDir = path.dirname(agentDir);\n const bound = byDir.get(agentDir);\n if (bound) bound.ids.push(id);\n else byDir.set(agentDir, { ref: instance.ref, ids: [id], instance });\n }\n const messages: string[] = [];\n for (const [agentDir, { ref, ids, instance }] of byDir) {\n const label = `${ids.length === 1 ? \"instance\" : \"instances\"} ${ids.join(\", \")}`;\n try {\n const drifted = await verifyConventionItems({\n agentDir,\n projectDir,\n registry: getKindRegistry(),\n });\n for (const err of drifted) messages.push(`${ref} (${label}): ${err.message}`);\n const manifest = await loadAgentManifest(agentDir);\n if (manifest) {\n await resolveAgentInstance({\n instanceId: ids[0]!,\n instance,\n asset: { manifest, dir: agentDir },\n projectDir,\n registry: getKindRegistry(),\n host: { nativeSubagents: true },\n dryRun: true,\n });\n }\n } catch (err) {\n if (!isCompositionError(err)) throw err;\n // Only the error `run` raises for a missing pin; other composition errors are not `check`'s.\n if (err.code === \"composition_rebuild_required\") {\n // A lock behind the library (a fresh clone after a persona bump): `rebuild` would fail\n // on it, so name `update` here, the same line `rebuild` and `install` give.\n const behind = await lockBehindLibraryErrors(agentDir, projectDir);\n if (behind.length > 0) {\n for (const e of behind) {\n messages.push(`${ref} (${label}): ${e.code}: ${e.message}`);\n }\n } else {\n messages.push(`${ref} (${label}): ${err.code}: ${err.message}`);\n }\n }\n }\n }\n return messages;\n}\n\n/**\n * Creates the `skaile clean` command.\n *\n * Removes all skaile-managed assets tracked in `skaile.lock.yaml` from the\n * workspace. With `--all` also removes history, patches, repos, and the lock\n * file itself. Preserves unmanaged (manually placed) assets.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-clean-command\n */\nexport function makeCleanCommand(): Command {\n return new Command(\"clean\")\n .description(\"Remove all skaile-managed assets from the workspace\")\n .option(\"--all\", \"Full reset: also remove history, patches, repos, and lock file\")\n .option(\"--dry-run\", \"Show what would be removed without doing it\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--target <agent>\", `Agent framework (${TARGET_DEFAULT_HINT})`)\n .option(\"--global\", \"Clean the global install (~/.skaile and every global harness)\")\n .option(\"--harness <ids>\", \"With --global: only these harnesses (comma-separated)\")\n .action(async (opts) => {\n const isGlobal = Boolean(opts.global || opts.harness);\n // A skaile.yaml that does not parse stops `clean` with one `✗` line (p910).\n if (!isGlobal) requireProjectConfig(opts.projectDir, { allowMissing: true });\n const am = isGlobal\n ? globalManager({ ...opts, global: true })\n : new AssetManager({\n registry: getKindRegistry(),\n projectDir: path.resolve(opts.projectDir),\n harness: opts.target as HarnessName,\n });\n\n // Preview: load lock file to show what will be cleaned\n const lock = readLock(\n isGlobal\n ? path.join(globalSkaileDir(), \"skaile.lock.yaml\")\n : path.resolve(opts.projectDir, \"skaile.lock.yaml\"),\n );\n\n if (!lock || Object.keys(lock.assets).length === 0) {\n logInfo(\"Nothing to clean (no skaile-managed assets found).\");\n return;\n }\n\n const assetRefs = Object.keys(lock.assets);\n console.log();\n console.log(` ${S.heading(\"Assets to remove:\")} ${S.dim(`(${assetRefs.length})`)}`);\n for (const ref of assetRefs) {\n console.log(` ${colorRef(ref)}`);\n }\n\n if (opts.all) {\n console.log();\n console.log(` ${S.heading(\"Also removing:\")}`);\n if (!isGlobal) {\n console.log(` ${S.dim(\".skaile/history.yaml\")}`);\n console.log(` ${S.dim(\".skaile/patches/\")}`);\n }\n console.log(` ${S.dim(isGlobal ? \"~/.skaile/skaile.lock.yaml\" : \"skaile.lock.yaml\")}`);\n }\n\n if (opts.dryRun) {\n console.log();\n logInfo(\"Dry run — no changes made.\");\n return;\n }\n\n if (!opts.yes) {\n const confirm = await p.confirm({ message: \"Proceed?\" });\n if (p.isCancel(confirm) || !confirm) {\n logInfo(\"Cancelled.\");\n return;\n }\n }\n\n const result = am.clean({ all: opts.all });\n\n console.log();\n for (const r of result.removed) {\n logOk(`Removed ${r}`);\n }\n for (const s of result.skipped) {\n logWarn(`Skipped ${s.ref}: ${s.reason}`);\n }\n if (result.unmanaged.length > 0) {\n console.log();\n logInfo(`Kept ${result.unmanaged.length} unmanaged asset(s):`);\n for (const u of result.unmanaged) {\n console.log(` ${S.dim(u)}`);\n }\n }\n if (opts.all) {\n console.log();\n logOk(\"Full reset complete.\");\n }\n });\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { loadRegistryView } from './chunk-
|
|
2
|
-
import { agentDefinitionProblem, instanceRefProblem, connectorErrorLines, CONNECTOR_SERVE_REFUSAL_CODES } from './chunk-
|
|
3
|
-
import { unknownHarnessMessage } from './chunk-
|
|
4
|
-
import { checkOmpListedModel, checkHarnessModel, checkOmpServeModel, isUnlistedModel } from './chunk-
|
|
1
|
+
import { loadRegistryView } from './chunk-IISEBVMA.js';
|
|
2
|
+
import { agentDefinitionProblem, instanceRefProblem, connectorErrorLines, CONNECTOR_SERVE_REFUSAL_CODES } from './chunk-DJSGQW2Q.js';
|
|
3
|
+
import { unknownHarnessMessage } from './chunk-BLBXOG5Q.js';
|
|
4
|
+
import { checkOmpListedModel, checkHarnessModel, checkOmpServeModel, isUnlistedModel } from './chunk-7UCPGQCW.js';
|
|
5
5
|
import { loadHarnessSdk, resolveSettings, sdkLookupPlaces, installCommandFor } from './chunk-4KPQ6ILH.js';
|
|
6
6
|
import { DEFAULT_HARNESS_ID } from './chunk-C5HFK34M.js';
|
|
7
7
|
import { resolveSkWorkspaceConfig, primaryAgentRef, loadSkWorkspaceConfig, SKAILE_YAML_DEFAULT } from './chunk-FZO64PLQ.js';
|
|
@@ -118,5 +118,5 @@ function checkServeConnectors(projectDir) {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
export { checkHarnessSdk, checkModelEndpointPeer, checkServeAgents, checkServeConnectors, checkServeHarness, checkServeModel, checkServeProjectDir, resolveServeProvider };
|
|
121
|
-
//# sourceMappingURL=chunk-
|
|
122
|
-
//# sourceMappingURL=chunk-
|
|
121
|
+
//# sourceMappingURL=chunk-Q5SSRVD5.js.map
|
|
122
|
+
//# sourceMappingURL=chunk-Q5SSRVD5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../cli/src/commands/serve-preflight.ts"],"names":[],"mappings":";;;;;;;;;;AAmCA,IAAM,YAAA,GAGF;AAAA,EACF,YAAA,EAAc;AAAA,IACZ,GAAA,EAAK,gCAAA;AAAA,IACL,IAAA,EAAM,CAAC,UAAA,KACL,cAAA;AAAA,MACE,gCAAA;AAAA,MACA,UAAA;AAAA,MACA,MAAM,OAAO,gCAAgC;AAAA;AAC/C,GACJ;AAAA,EACA,KAAA,EAAO;AAAA,IACL,GAAA,EAAK,mBAAA;AAAA,IACL,IAAA,EAAM,CAAC,UAAA,KACL,cAAA,CAAe,qBAAqB,UAAA,EAAY,MAAM,OAAO,mBAAmB,CAAC;AAAA;AAEvF,CAAA;AAYA,eAAsB,eAAA,CACpB,UAAA,EACA,eAAA,EACA,KAAA,GAA6B,YAAA,EACL;AACxB,EAAA,MAAM,WAAW,MAAM,eAAA;AAAA,IACrB,UAAA;AAAA,IACA,eAAA,GAAkB,EAAE,OAAA,EAAS,eAAA,KAAoB;AAAC,GACpD;AACA,EAAA,MAAM,OAAA,GAAU,SAAS,OAAA,IAAW,kBAAA;AACpC,EAAA,MAAM,GAAA,GAAM,MAAM,OAAO,CAAA;AACzB,EAAA,IAAI,CAAC,KAAK,OAAO,IAAA;AACjB,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,CAAI,KAAK,UAAU,CA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K,IAAA;AAC1E;AAWO,SAAS,iBAAiB,UAAA,EAAmC;AAClE,EAAA,MAAM,MAAA,GAAS,yBAAyB,UAAU,CAAA;AAClD,EAAA,MAAM,UAAA,GAAa,gBAAgB,MAAM,CAAA;AACzC,EAAA,MAAM,iBAAA,GAAoB,UAAA,GAAa,sBAAA,CAAuB,UAAA,EAAY,UAAU,CAAA,GAAI,IAAA;AACxF,EAAA,IAAI,mBAAmB,OAAO,iBAAA;AAC9B,EAAA,KAAA,MAAW,CAAC,EAAA,EAAI,QAAQ,CAAA,IAAK,MAAA,CAAO,OAAA,CAAQ,MAAA,CAAO,KAAA,EAAO,SAAA,IAAa,EAAE,CAAA,EAAG;AAC1E,IAAA,MAAM,OAAA,GAAU,kBAAA,CAAmB,UAAA,EAAY,EAAA,EAAI,SAAS,GAAG,CAAA;AAC/D,IAAA,IAAI,SAAS,OAAO,OAAA;AAAA,EACtB;AACA,EAAA,OAAO,IAAA;AACT;AAWO,SAAS,qBAAqB,UAAA,EAAmC;AACtE,EAAA,MAAM,IAAA,GAAO,sBAAsB,UAAU,CAAA;AAC7C,EAAA,MAAM,KAAA,GAAQ,mBAAA;AAAA,IACZ,IAAA,EAAM,eAAe,EAAC;AAAA,IACtB,mBAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,OAAO,MAAM,MAAA,GAAS,CAAA,GAAI,KAAA,CAAM,IAAA,CAAK,IAAI,CAAA,GAAI,IAAA;AAC/C","file":"chunk-X2B5GMJO.js","sourcesContent":["/**\n * Start-up checks for `skaile serve`: fail with one actionable line before the\n * runner reports ready, instead of on the first prompt.\n */\n\nimport { statSync } from \"node:fs\";\nimport {\n checkHarnessModel,\n checkOmpListedModel,\n checkOmpServeModel,\n isUnlistedModel,\n} from \"@skaile/workspaces/bridge\";\nimport {\n isEntryEnabled,\n type MergedAIProviderRegistry,\n pickRegistryEntries,\n registryEntries,\n} from \"@skaile/workspaces/core/provider-registry\";\nimport { loadRegistryView } from \"./providers.ts\";\nimport {\n DEFAULT_HARNESS_ID,\n installCommandFor,\n loadHarnessSdk,\n loadSkWorkspaceConfig,\n primaryAgentRef,\n resolveSettings,\n resolveSkWorkspaceConfig,\n SKAILE_YAML_DEFAULT,\n sdkLookupPlaces,\n} from \"@skaile/workspaces/core\";\nimport { CONNECTOR_SERVE_REFUSAL_CODES, connectorErrorLines } from \"../config-checks.ts\";\nimport { unknownHarnessMessage } from \"../harness-error.ts\";\nimport { agentDefinitionProblem, instanceRefProblem } from \"./validate-instances.ts\";\n\n/** Optional SDK a harness needs at run time, and how to probe that it loads from a project. */\nconst HARNESS_SDKS: Record<\n string,\n { pkg: string; load: (projectDir: string) => Promise<unknown> }\n> = {\n \"claude-sdk\": {\n pkg: \"@anthropic-ai/claude-agent-sdk\",\n load: (projectDir) =>\n loadHarnessSdk(\n \"@anthropic-ai/claude-agent-sdk\",\n projectDir,\n () => import(\"@anthropic-ai/claude-agent-sdk\"),\n ),\n },\n codex: {\n pkg: \"@openai/codex-sdk\",\n load: (projectDir) =>\n loadHarnessSdk(\"@openai/codex-sdk\", projectDir, () => import(\"@openai/codex-sdk\")),\n },\n};\n\n/**\n * Check that the harness `skaile serve` would start can load its SDK. The probe\n * is the same lookup the harness runs in `start()` (the project's `node_modules`,\n * then next to skaile), so a compiled binary that bundles the SDK passes.\n *\n * @param projectDir - Project the server serves.\n * @param harnessOverride - `--harness`, when given.\n * @param probe - Replaceable loader table, for tests.\n * @returns The one-line problem, or `null` when the harness can start.\n */\nexport async function checkHarnessSdk(\n projectDir: string,\n harnessOverride?: string,\n probe: typeof HARNESS_SDKS = HARNESS_SDKS,\n): Promise<string | null> {\n const settings = await resolveSettings(\n projectDir,\n harnessOverride ? { harness: harnessOverride } : {},\n );\n const harness = settings.harness ?? DEFAULT_HARNESS_ID;\n const sdk = probe[harness];\n if (!sdk) return null;\n try {\n await sdk.load(projectDir);\n return null;\n } catch {\n return `The ${harness} harness needs ${sdk.pkg}, which is not installed. Looked in ${sdkLookupPlaces(projectDir)}. Run in the project: ${installCommandFor(sdk.pkg, projectDir)} (or pick another harness with --harness).`;\n }\n}\n\n/**\n * Check that the model endpoint can load pi-ai, when `skaile serve` will start the\n * endpoint (`--model-endpoint`, or `model_endpoint.enabled` in skaile.yaml). Without\n * this the endpoint printed its ready line and answered every request with a 500.\n *\n * @param projectDir - Project the server serves.\n * @param flag - Parsed `--model-endpoint`, when given.\n * @param probe - Replaceable pi-ai check, for tests.\n * @returns The one-line problem (both places looked in, the install command), or `null`.\n */\nexport async function checkModelEndpointPeer(\n projectDir: string,\n flag: { enabled?: boolean } | undefined,\n probe?: (projectDir: string) => Promise<string | null>,\n): Promise<string | null> {\n const enabled =\n flag?.enabled ?? resolveSkWorkspaceConfig(projectDir).model_endpoint?.enabled === true;\n if (!enabled) return null;\n const check = probe ?? (await import(\"@skaile/workspaces/model-endpoint\")).checkPiAiInstalled;\n return check(projectDir);\n}\n\n/**\n * Check that the harness `skaile serve` would start can take the model given with `--model`: the\n * refusal a first prompt would raise as a fatal `error` (p1334), one line before the ready line.\n * The same check as `skaile run --dry-run`.\n *\n * Only an explicit `--model` is checked. A model that comes from `skaile.yaml` or the settings\n * files is not: the platform sends its registry layer at `session_init`, after the server is up,\n * so a provider the local `providers.yml` lacks may still be served. That model is checked at\n * the first prompt, as before. The check sees the local registry, narrowed by `--providers` as\n * the session narrows it, and is skipped when the registry comes from the host\n * (`secrets.provider` other than `env`).\n *\n * @param projectDir - Project the server serves.\n * @param overrides - `--harness`, `--model` and `--providers`, when given.\n * @param registry - Replaceable registry loader, for tests.\n * @param ompListed - Replaceable omp model lookup (`omp models find`), for tests.\n * @returns The one-line refusal, or `null` when the harness takes the model.\n */\nexport async function checkServeModel(\n projectDir: string,\n overrides: { harness?: string; model?: string; providers?: readonly string[] },\n registry: () => MergedAIProviderRegistry = () => loadRegistryView({ projectDir }).merged,\n ompListed: (model: string) => Promise<string | undefined> = checkOmpListedModel,\n): Promise<string | null> {\n if (!overrides.model) return null;\n // The platform delivers its registry layer over the transport after the server is up (p1332).\n const secretsProvider = resolveSkWorkspaceConfig(projectDir).secrets?.provider;\n if (secretsProvider && secretsProvider !== \"env\") return null;\n const settings = await resolveSettings(projectDir, {\n ...(overrides.harness ? { harness: overrides.harness } : {}),\n model: overrides.model,\n });\n if (!settings.model) return null;\n const local = registry();\n const narrowed = overrides.providers?.length\n ? pickRegistryEntries(local, overrides.providers)\n : local;\n const harness = settings.harness ?? DEFAULT_HARNESS_ID;\n const input = { registry: narrowed, model: settings.model };\n // A server answers its first prompt after it is ready: omp must be known to take the model now (p1334).\n const refusal =\n checkHarnessModel(harness, input) ??\n (harness === \"omp\" ? checkOmpServeModel(input) : undefined);\n if (refusal) return refusal;\n // No enabled registry entry, or an id no entry lists (it goes to omp as typed): omp serves\n // it from its own catalog, which only omp can list.\n const ownHome =\n harness === \"omp\" &&\n (isUnlistedModel(input) ||\n !registryEntries(narrowed).some(\n ([, entry]) => (entry.kind === \"llm\" || entry.kind === \"embed\") && isEntryEnabled(entry),\n ));\n return (ownHome ? await ompListed(settings.model) : undefined) ?? null;\n}\n\n/**\n * Resolve `--provider <name>`: it picks one AI provider registry entry, the way\n * `--providers <ids>` picks several. The session then holds that entry only.\n *\n * Fails, with one line, when the entry is not in the local registry\n * (`providers.yml` and the layers above it) or when `--providers` is given\n * too and does not list it. The registry check is skipped when the registry\n * comes from the host (`secrets.provider` other than `env`): the platform\n * sends its entries at `session_init`, after the server is up.\n *\n * @param projectDir - Project the server serves.\n * @param provider - `--provider`, when given.\n * @param providers - Ids of `--providers`, when given.\n * @param registry - Replaceable registry loader, for tests.\n * @returns The entry ids the session keeps, or the one-line problem.\n */\nexport function resolveServeProvider(\n projectDir: string,\n provider: string | undefined,\n providers: readonly string[],\n registry: () => MergedAIProviderRegistry = () => loadRegistryView({ projectDir }).merged,\n): { providers: readonly string[] } | { problem: string } {\n const id = provider?.trim();\n if (!id) return { providers };\n if (providers.length > 0 && !providers.includes(id)) {\n return {\n problem: `--provider '${id}' is not in --providers (${providers.join(\", \")}). Use one of the two flags.`,\n };\n }\n const secretsProvider = resolveSkWorkspaceConfig(projectDir).secrets?.provider;\n if (!secretsProvider || secretsProvider === \"env\") {\n const known = registryEntries(registry()).map(([entryId]) => entryId);\n if (!known.includes(id)) {\n return {\n problem:\n known.length > 0\n ? `--provider: '${id}' is not an AI provider entry. Defined: ${known.join(\", \")}. Run: skaile providers list`\n : `--provider: '${id}' is not an AI provider entry; none is defined. Run: skaile providers add`,\n };\n }\n }\n return { providers: providers.length > 0 ? providers : [id] };\n}\n\n/**\n * Check that `--project-dir` is an existing directory, before `serve` creates anything in it. A\n * missing folder used to fail with a raw `ENOENT` stack from the log store (p1732). A symlink to\n * a directory passes; a relative path is read from the current directory.\n *\n * @param projectDir - The `--project-dir` value as typed.\n * @returns The one-line problem, or `null` when the directory exists.\n */\nexport function checkServeProjectDir(projectDir: string): string | null {\n try {\n if (statSync(projectDir).isDirectory()) return null;\n } catch {\n // missing, a dangling link or unreadable: the same line\n }\n return `--project-dir: '${projectDir}' is not a directory`;\n}\n\n/**\n * Check that the harness `skaile serve` would start is one that is registered: `--harness`, else\n * the project's settings, else the default. The same refusal `run` prints; without it the first\n * session build died with a raw stack (p1731). Load the project's plugins first: a plugin's\n * harness counts.\n *\n * @param projectDir - Project the server serves.\n * @param harnessOverride - `--harness`, when given.\n * @returns The one-line problem, or `null` when the harness is known.\n */\nexport async function checkServeHarness(\n projectDir: string,\n harnessOverride?: string,\n): Promise<string | null> {\n const settings = await resolveSettings(\n projectDir,\n harnessOverride ? { harness: harnessOverride } : {},\n );\n return unknownHarnessMessage(settings.harness ?? DEFAULT_HARNESS_ID) ?? null;\n}\n\n/**\n * Check that `agent.definition` and the `ref` of every `agents:` instance in the project's\n * `skaile.yaml` resolve: the `agent_ref_unresolved` rule `validate` applies. Without it\n * `serve` died with a raw `AgentRefResolutionError` stack for the definition and started with no\n * word for an instance it could not resolve.\n *\n * @param projectDir - Project the server serves.\n * @returns The first error message, or `null` when nothing is set or everything resolves.\n */\nexport function checkServeAgents(projectDir: string): string | null {\n const config = resolveSkWorkspaceConfig(projectDir);\n const definition = primaryAgentRef(config);\n const definitionProblem = definition ? agentDefinitionProblem(projectDir, definition) : null;\n if (definitionProblem) return definitionProblem;\n for (const [id, instance] of Object.entries(config.agent?.instances ?? {})) {\n const problem = instanceRefProblem(projectDir, id, instance.ref);\n if (problem) return problem;\n }\n return null;\n}\n\n/**\n * Check that the connectors `skaile.yaml` declares are ones the runner can mount: the\n * `connector_*` rules `validate` applies (no `driver`, no `id`, a duplicate `id`, an `access`\n * that is neither `read-only` nor `read-write`). Without it `serve` mounted a connector with no\n * `id`, and one with `access: rw` that nothing stopped from writing.\n *\n * @param projectDir - Project the server serves.\n * @returns One line per error, joined by newlines, or `null` when every connector is fine.\n */\nexport function checkServeConnectors(projectDir: string): string | null {\n const file = loadSkWorkspaceConfig(projectDir);\n const lines = connectorErrorLines(\n file?.diagnostics ?? [],\n SKAILE_YAML_DEFAULT,\n CONNECTOR_SERVE_REFUSAL_CODES,\n );\n return lines.length > 0 ? lines.join(\"\\n\") : null;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../cli/src/commands/serve-preflight.ts"],"names":[],"mappings":";;;;;;;;;;AAmCA,IAAM,YAAA,GAGF;AAAA,EACF,YAAA,EAAc;AAAA,IACZ,GAAA,EAAK,gCAAA;AAAA,IACL,IAAA,EAAM,CAAC,UAAA,KACL,cAAA;AAAA,MACE,gCAAA;AAAA,MACA,UAAA;AAAA,MACA,MAAM,OAAO,gCAAgC;AAAA;AAC/C,GACJ;AAAA,EACA,KAAA,EAAO;AAAA,IACL,GAAA,EAAK,mBAAA;AAAA,IACL,IAAA,EAAM,CAAC,UAAA,KACL,cAAA,CAAe,qBAAqB,UAAA,EAAY,MAAM,OAAO,mBAAmB,CAAC;AAAA;AAEvF,CAAA;AAYA,eAAsB,eAAA,CACpB,UAAA,EACA,eAAA,EACA,KAAA,GAA6B,YAAA,EACL;AACxB,EAAA,MAAM,WAAW,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**\n * Start-up checks for `skaile serve`: fail with one actionable line before the\n * runner reports ready, instead of on the first prompt.\n */\n\nimport { statSync } from \"node:fs\";\nimport {\n checkHarnessModel,\n checkOmpListedModel,\n checkOmpServeModel,\n isUnlistedModel,\n} from \"@skaile/workspaces/bridge\";\nimport {\n isEntryEnabled,\n type MergedAIProviderRegistry,\n pickRegistryEntries,\n registryEntries,\n} from \"@skaile/workspaces/core/provider-registry\";\nimport { loadRegistryView } from \"./providers.ts\";\nimport {\n DEFAULT_HARNESS_ID,\n installCommandFor,\n loadHarnessSdk,\n loadSkWorkspaceConfig,\n primaryAgentRef,\n resolveSettings,\n resolveSkWorkspaceConfig,\n SKAILE_YAML_DEFAULT,\n sdkLookupPlaces,\n} from \"@skaile/workspaces/core\";\nimport { CONNECTOR_SERVE_REFUSAL_CODES, connectorErrorLines } from \"../config-checks.ts\";\nimport { unknownHarnessMessage } from \"../harness-error.ts\";\nimport { agentDefinitionProblem, instanceRefProblem } from \"./validate-instances.ts\";\n\n/** Optional SDK a harness needs at run time, and how to probe that it loads from a project. */\nconst HARNESS_SDKS: Record<\n string,\n { pkg: string; load: (projectDir: string) => Promise<unknown> }\n> = {\n \"claude-sdk\": {\n pkg: \"@anthropic-ai/claude-agent-sdk\",\n load: (projectDir) =>\n loadHarnessSdk(\n \"@anthropic-ai/claude-agent-sdk\",\n projectDir,\n () => import(\"@anthropic-ai/claude-agent-sdk\"),\n ),\n },\n codex: {\n pkg: \"@openai/codex-sdk\",\n load: (projectDir) =>\n loadHarnessSdk(\"@openai/codex-sdk\", projectDir, () => import(\"@openai/codex-sdk\")),\n },\n};\n\n/**\n * Check that the harness `skaile serve` would start can load its SDK. The probe\n * is the same lookup the harness runs in `start()` (the project's `node_modules`,\n * then next to skaile), so a compiled binary that bundles the SDK passes.\n *\n * @param projectDir - Project the server serves.\n * @param harnessOverride - `--harness`, when given.\n * @param probe - Replaceable loader table, for tests.\n * @returns The one-line problem, or `null` when the harness can start.\n */\nexport async function checkHarnessSdk(\n projectDir: string,\n harnessOverride?: string,\n probe: typeof HARNESS_SDKS = HARNESS_SDKS,\n): Promise<string | null> {\n const settings = await resolveSettings(\n projectDir,\n harnessOverride ? { harness: harnessOverride } : {},\n );\n const harness = settings.harness ?? DEFAULT_HARNESS_ID;\n const sdk = probe[harness];\n if (!sdk) return null;\n try {\n await sdk.load(projectDir);\n return null;\n } catch {\n return `The ${harness} harness needs ${sdk.pkg}, which is not installed. Looked in ${sdkLookupPlaces(projectDir)}. Run in the project: ${installCommandFor(sdk.pkg, projectDir)} (or pick another harness with --harness).`;\n }\n}\n\n/**\n * Check that the model endpoint can load pi-ai, when `skaile serve` will start the\n * endpoint (`--model-endpoint`, or `model_endpoint.enabled` in skaile.yaml). Without\n * this the endpoint printed its ready line and answered every request with a 500.\n *\n * @param projectDir - Project the server serves.\n * @param flag - Parsed `--model-endpoint`, when given.\n * @param probe - Replaceable pi-ai check, for tests.\n * @returns The one-line problem (both places looked in, the install command), or `null`.\n */\nexport async function checkModelEndpointPeer(\n projectDir: string,\n flag: { enabled?: boolean } | undefined,\n probe?: (projectDir: string) => Promise<string | null>,\n): Promise<string | null> {\n const enabled =\n flag?.enabled ?? resolveSkWorkspaceConfig(projectDir).model_endpoint?.enabled === true;\n if (!enabled) return null;\n const check = probe ?? (await import(\"@skaile/workspaces/model-endpoint\")).checkPiAiInstalled;\n return check(projectDir);\n}\n\n/**\n * Check that the harness `skaile serve` would start can take the model given with `--model`: the\n * refusal a first prompt would raise as a fatal `error` (p1334), one line before the ready line.\n * The same check as `skaile run --dry-run`.\n *\n * Only an explicit `--model` is checked. A model that comes from `skaile.yaml` or the settings\n * files is not: the platform sends its registry layer at `session_init`, after the server is up,\n * so a provider the local `providers.yml` lacks may still be served. That model is checked at\n * the first prompt, as before. The check sees the local registry, narrowed by `--providers` as\n * the session narrows it, and is skipped when the registry comes from the host\n * (`secrets.provider` other than `env`).\n *\n * @param projectDir - Project the server serves.\n * @param overrides - `--harness`, `--model` and `--providers`, when given.\n * @param registry - Replaceable registry loader, for tests.\n * @param ompListed - Replaceable omp model lookup (`omp models find`), for tests.\n * @returns The one-line refusal, or `null` when the harness takes the model.\n */\nexport async function checkServeModel(\n projectDir: string,\n overrides: { harness?: string; model?: string; providers?: readonly string[] },\n registry: () => MergedAIProviderRegistry = () => loadRegistryView({ projectDir }).merged,\n ompListed: (model: string) => Promise<string | undefined> = checkOmpListedModel,\n): Promise<string | null> {\n if (!overrides.model) return null;\n // The platform delivers its registry layer over the transport after the server is up (p1332).\n const secretsProvider = resolveSkWorkspaceConfig(projectDir).secrets?.provider;\n if (secretsProvider && secretsProvider !== \"env\") return null;\n const settings = await resolveSettings(projectDir, {\n ...(overrides.harness ? { harness: overrides.harness } : {}),\n model: overrides.model,\n });\n if (!settings.model) return null;\n const local = registry();\n const narrowed = overrides.providers?.length\n ? pickRegistryEntries(local, overrides.providers)\n : local;\n const harness = settings.harness ?? DEFAULT_HARNESS_ID;\n const input = { registry: narrowed, model: settings.model };\n // A server answers its first prompt after it is ready: omp must be known to take the model now (p1334).\n const refusal =\n checkHarnessModel(harness, input) ??\n (harness === \"omp\" ? checkOmpServeModel(input) : undefined);\n if (refusal) return refusal;\n // No enabled registry entry, or an id no entry lists (it goes to omp as typed): omp serves\n // it from its own catalog, which only omp can list.\n const ownHome =\n harness === \"omp\" &&\n (isUnlistedModel(input) ||\n !registryEntries(narrowed).some(\n ([, entry]) => (entry.kind === \"llm\" || entry.kind === \"embed\") && isEntryEnabled(entry),\n ));\n return (ownHome ? await ompListed(settings.model) : undefined) ?? null;\n}\n\n/**\n * Resolve `--provider <name>`: it picks one AI provider registry entry, the way\n * `--providers <ids>` picks several. The session then holds that entry only.\n *\n * Fails, with one line, when the entry is not in the local registry\n * (`providers.yml` and the layers above it) or when `--providers` is given\n * too and does not list it. The registry check is skipped when the registry\n * comes from the host (`secrets.provider` other than `env`): the platform\n * sends its entries at `session_init`, after the server is up.\n *\n * @param projectDir - Project the server serves.\n * @param provider - `--provider`, when given.\n * @param providers - Ids of `--providers`, when given.\n * @param registry - Replaceable registry loader, for tests.\n * @returns The entry ids the session keeps, or the one-line problem.\n */\nexport function resolveServeProvider(\n projectDir: string,\n provider: string | undefined,\n providers: readonly string[],\n registry: () => MergedAIProviderRegistry = () => loadRegistryView({ projectDir }).merged,\n): { providers: readonly string[] } | { problem: string } {\n const id = provider?.trim();\n if (!id) return { providers };\n if (providers.length > 0 && !providers.includes(id)) {\n return {\n problem: `--provider '${id}' is not in --providers (${providers.join(\", \")}). Use one of the two flags.`,\n };\n }\n const secretsProvider = resolveSkWorkspaceConfig(projectDir).secrets?.provider;\n if (!secretsProvider || secretsProvider === \"env\") {\n const known = registryEntries(registry()).map(([entryId]) => entryId);\n if (!known.includes(id)) {\n return {\n problem:\n known.length > 0\n ? `--provider: '${id}' is not an AI provider entry. Defined: ${known.join(\", \")}. Run: skaile providers list`\n : `--provider: '${id}' is not an AI provider entry; none is defined. Run: skaile providers add`,\n };\n }\n }\n return { providers: providers.length > 0 ? providers : [id] };\n}\n\n/**\n * Check that `--project-dir` is an existing directory, before `serve` creates anything in it. A\n * missing folder used to fail with a raw `ENOENT` stack from the log store (p1732). A symlink to\n * a directory passes; a relative path is read from the current directory.\n *\n * @param projectDir - The `--project-dir` value as typed.\n * @returns The one-line problem, or `null` when the directory exists.\n */\nexport function checkServeProjectDir(projectDir: string): string | null {\n try {\n if (statSync(projectDir).isDirectory()) return null;\n } catch {\n // missing, a dangling link or unreadable: the same line\n }\n return `--project-dir: '${projectDir}' is not a directory`;\n}\n\n/**\n * Check that the harness `skaile serve` would start is one that is registered: `--harness`, else\n * the project's settings, else the default. The same refusal `run` prints; without it the first\n * session build died with a raw stack (p1731). Load the project's plugins first: a plugin's\n * harness counts.\n *\n * @param projectDir - Project the server serves.\n * @param harnessOverride - `--harness`, when given.\n * @returns The one-line problem, or `null` when the harness is known.\n */\nexport async function checkServeHarness(\n projectDir: string,\n harnessOverride?: string,\n): Promise<string | null> {\n const settings = await resolveSettings(\n projectDir,\n harnessOverride ? { harness: harnessOverride } : {},\n );\n return unknownHarnessMessage(settings.harness ?? DEFAULT_HARNESS_ID) ?? null;\n}\n\n/**\n * Check that `agent.definition` and the `ref` of every `agents:` instance in the project's\n * `skaile.yaml` resolve: the `agent_ref_unresolved` rule `validate` applies. Without it\n * `serve` died with a raw `AgentRefResolutionError` stack for the definition and started with no\n * word for an instance it could not resolve.\n *\n * @param projectDir - Project the server serves.\n * @returns The first error message, or `null` when nothing is set or everything resolves.\n */\nexport function checkServeAgents(projectDir: string): string | null {\n const config = resolveSkWorkspaceConfig(projectDir);\n const definition = primaryAgentRef(config);\n const definitionProblem = definition ? agentDefinitionProblem(projectDir, definition) : null;\n if (definitionProblem) return definitionProblem;\n for (const [id, instance] of Object.entries(config.agent?.instances ?? {})) {\n const problem = instanceRefProblem(projectDir, id, instance.ref);\n if (problem) return problem;\n }\n return null;\n}\n\n/**\n * Check that the connectors `skaile.yaml` declares are ones the runner can mount: the\n * `connector_*` rules `validate` applies (no `driver`, no `id`, a duplicate `id`, an `access`\n * that is neither `read-only` nor `read-write`). Without it `serve` mounted a connector with no\n * `id`, and one with `access: rw` that nothing stopped from writing.\n *\n * @param projectDir - Project the server serves.\n * @returns One line per error, joined by newlines, or `null` when every connector is fine.\n */\nexport function checkServeConnectors(projectDir: string): string | null {\n const file = loadSkWorkspaceConfig(projectDir);\n const lines = connectorErrorLines(\n file?.diagnostics ?? [],\n SKAILE_YAML_DEFAULT,\n CONNECTOR_SERVE_REFUSAL_CODES,\n );\n return lines.length > 0 ? lines.join(\"\\n\") : null;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { selectableEntries, entryModelIds, entrySurface, entryBaseUrl } from './chunk-
|
|
2
|
-
import { entryCredentialValue } from './chunk-
|
|
1
|
+
import { selectableEntries, entryModelIds, entrySurface, entryBaseUrl } from './chunk-RP3ML3QD.js';
|
|
2
|
+
import { entryCredentialValue } from './chunk-7TF5MNFK.js';
|
|
3
3
|
import { buildCredentialHeaders } from './chunk-6UP2EDFN.js';
|
|
4
4
|
import { listenWithProbe, loadHarnessSdkSubpath, loadHarnessSdk } from './chunk-4KPQ6ILH.js';
|
|
5
5
|
import { parseModelRef } from './chunk-RXGPFAMN.js';
|
|
@@ -1861,5 +1861,5 @@ function errorText(err) {
|
|
|
1861
1861
|
}
|
|
1862
1862
|
|
|
1863
1863
|
export { AGENT_MODEL_ID, ModelEndpointError, checkPiAiInstalled, listModels, resolveModel, startModelEndpoint };
|
|
1864
|
-
//# sourceMappingURL=chunk-
|
|
1865
|
-
//# sourceMappingURL=chunk-
|
|
1864
|
+
//# sourceMappingURL=chunk-QIV7H3GJ.js.map
|
|
1865
|
+
//# sourceMappingURL=chunk-QIV7H3GJ.js.map
|