* feat(#1680): ADR-1239 Phase C-1 — declarative embedding adapter + minimal HostIntegrationInterface [AC1] Phase 3 slice 1 (AC1). Names + bounds today's projection path behind the common HostIntegrationInterface that both declarative + imperative adapters will satisfy. - src/embedding-adapter.cts: minimal HostIntegrationInterface (kind + runtime + install/uninstall) + ADAPTER_KINDS. The full 6-point binding surface (command/dispatch/model/hooks/state/artifact) is DEFERRED until the imperative adapter (AC2) fixes the shape — ADR-1239 lists the wire-shape as an open question; freezing it now risks rework across Phases 3-6. - src/adapter-declarative.cts: createDeclarativeAdapter({runtime}) factory. Delegates in-process to install-engine installRuntimeArtifacts / uninstallRuntimeArtifacts (the SAME engine functions bin/install.js uses), so output is byte-identical to today's install (gated by golden-install-parity). Module-ref call style = monkeypatch-friendly for tests. Lossy by design: projects files, does not drive the loop (that's the imperative adapter, AC2). - tests/adapter-declarative-equivalence.test.cjs: kind classification (all 16 runtimes), install/uninstall delegation with exact args (the byte-identity link), fail-closed construction (missing/invalid runtime throws). Purely additive — no install.js/install-engine changes. Unblocks AC2 (imperative adapter) + AC3/AC4 (model/hook/state seams) as follow-up slices. * chore(changeset): add Changed fragment for declarative embedding adapter (#1680) * fix(lint): ignore tsc-emitted embedding-adapter/adapter-declarative .cjs (ADR-457) The new src/embedding-adapter.cts + src/adapter-declarative.cts modules' emitted gsd-core/bin/lib/*.cjs artifacts must join the ADR-457 ignores list (lint the src/*.cts source, not the emitted .cjs). Without this, the .cjs is linted under js.recommended where @typescript-eslint/no-require-imports is undefined, so the verbatim-copied eslint-disable directive surfaces as 'Definition for rule not found' — failing the lint-tests CI job. Also restores the clean line-level disable in adapter-declarative.cts (valid in the .cts source context where the rule IS defined). * fix(docs): add adapter-declarative + embedding-adapter to INVENTORY-MANIFEST cli_modules The new ADR-1239 Phase C-1 modules' built .cjs artifacts must be registered in docs/INVENTORY-MANIFEST.json's cli_modules array or the 'docs/INVENTORY-MANIFEST.json matches the filesystem' drift test fails on CI. Mirrors the existing sorted entries.
43 lines
1.8 KiB
TypeScript
43 lines
1.8 KiB
TypeScript
/**
|
|
* Declarative embedding adapter (ADR-1239 Phase C-1, AC1 / #1680).
|
|
*
|
|
* NAMES + BOUNDS today's projection path (file emission via install-engine)
|
|
* behind `HostIntegrationInterface`. The declarative adapter is lossy by
|
|
* design: it projects skills/agents/commands and does NOT drive the loop
|
|
* orchestration (that is the imperative adapter's job, AC2 / a later slice).
|
|
*
|
|
* `install`/`uninstall` delegate IN-PROCESS to install-engine's
|
|
* `installRuntimeArtifacts` / `uninstallRuntimeArtifacts` — the SAME engine
|
|
* functions `bin/install.js` uses — so the adapter's output is byte-identical to
|
|
* today's install (the link is gated by `tests/golden-install-parity.test.cjs`).
|
|
* The module-ref call style (`installEngine.fn`) keeps it monkeypatch-friendly
|
|
* for tests, mirroring the install-engine.cts:31-38 pattern.
|
|
*/
|
|
'use strict';
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
import installEngine = require('./install-engine.cjs');
|
|
import type { HostIntegrationInterface, AdapterInstallIntent, AdapterUninstallIntent } from './embedding-adapter.cjs';
|
|
|
|
export function createDeclarativeAdapter({ runtime }: { runtime: string }): HostIntegrationInterface {
|
|
if (!runtime || typeof runtime !== 'string') {
|
|
throw new TypeError('createDeclarativeAdapter: runtime is required (non-empty string)');
|
|
}
|
|
return Object.freeze({
|
|
kind: 'declarative' as const,
|
|
runtime,
|
|
install(intent: AdapterInstallIntent): void {
|
|
installEngine.installRuntimeArtifacts(
|
|
runtime,
|
|
intent.configDir,
|
|
intent.scope,
|
|
intent.resolvedProfile,
|
|
intent.resolveAttribution,
|
|
);
|
|
},
|
|
uninstall(intent: AdapterUninstallIntent): void {
|
|
installEngine.uninstallRuntimeArtifacts(runtime, intent.configDir, intent.scope);
|
|
},
|
|
});
|
|
}
|