stratagate-dsh 0.3.16 → 0.3.17

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/dist/plugin.js CHANGED
@@ -8241,6 +8241,7 @@ var StrataGate = class _StrataGate {
8241
8241
  // src/dsh-compatibility.ts
8242
8242
  import { readFileSync } from "node:fs";
8243
8243
  import { createRequire } from "node:module";
8244
+ import { satisfies } from "semver";
8244
8245
  var nodeRequire = createRequire(import.meta.url);
8245
8246
  var CORE_RUNTIME_PACKAGES = [
8246
8247
  "@deepseek-ai/cordis",
@@ -8260,93 +8261,26 @@ var SESSION_FORMAT_PACKAGES = [
8260
8261
  "@deepseek-ai/dsh-session-format-v0-to-v1"
8261
8262
  ];
8262
8263
  var RUNTIME_PACKAGES = [...CORE_RUNTIME_PACKAGES, ...SESSION_FORMAT_PACKAGES];
8263
- var SUPPORTED_RUNTIME_FAMILIES = [
8264
- {
8265
- cli: "0.1.2-rc.1",
8266
- versions: {
8267
- "@deepseek-ai/cordis": "4.0.2",
8268
- "@deepseek-ai/dsh-agent-default-model": "0.1.2-rc.1",
8269
- "@deepseek-ai/dsh-client-ui-conversation": "0.1.2-rc.1",
8270
- "@deepseek-ai/dsh-llm": "0.1.2-rc.1",
8271
- "@deepseek-ai/dsh-native-command": "0.1.2-rc.1",
8272
- "@deepseek-ai/dsh-session": "0.1.2-rc.1",
8273
- "@deepseek-ai/dsh-settings": "0.1.2-rc.1",
8274
- "@deepseek-ai/dsh-system-prompt": "0.1.2-rc.1",
8275
- "@deepseek-ai/dsh-tools": "0.1.2-rc.1",
8276
- "@deepseek-ai/schemastery": "3.18.2"
8277
- }
8278
- },
8279
- {
8280
- cli: "0.1.5-rc.1",
8281
- versions: {
8282
- "@deepseek-ai/cordis": "4.0.2",
8283
- "@deepseek-ai/dsh-agent-default-model": "0.1.5-rc.2",
8284
- "@deepseek-ai/dsh-client-ui-conversation": "0.1.5-rc.2",
8285
- "@deepseek-ai/dsh-llm": "0.1.5-rc.2",
8286
- "@deepseek-ai/dsh-native-command": "0.1.5-rc.2",
8287
- "@deepseek-ai/dsh-session": "0.1.5-rc.2",
8288
- "@deepseek-ai/dsh-settings": "0.1.5-rc.2",
8289
- "@deepseek-ai/dsh-system-prompt": "0.1.5-rc.2",
8290
- "@deepseek-ai/dsh-tools": "0.1.5-rc.2",
8291
- "@deepseek-ai/schemastery": "3.18.2"
8292
- }
8293
- },
8294
- {
8295
- cli: "0.1.6-alpha.1",
8296
- versions: {
8297
- "@deepseek-ai/cordis": "4.0.2",
8298
- "@deepseek-ai/dsh-agent-default-model": "0.1.6-alpha.1",
8299
- "@deepseek-ai/dsh-client-ui-conversation": "0.1.6-alpha.1",
8300
- "@deepseek-ai/dsh-llm": "0.1.6-alpha.1",
8301
- "@deepseek-ai/dsh-native-command": "0.1.6-alpha.1",
8302
- "@deepseek-ai/dsh-session": "0.1.6-alpha.1",
8303
- "@deepseek-ai/dsh-settings": "0.1.6-alpha.1",
8304
- "@deepseek-ai/dsh-system-prompt": "0.1.6-alpha.1",
8305
- "@deepseek-ai/dsh-tools": "0.1.6-alpha.1",
8306
- "@deepseek-ai/schemastery": "3.18.2"
8307
- }
8308
- },
8309
- {
8310
- cli: "0.1.7-rc.1",
8311
- versions: {
8312
- "@deepseek-ai/cordis": "4.0.4",
8313
- "@deepseek-ai/dsh-agent-default-model": "0.1.7-rc.1",
8314
- "@deepseek-ai/dsh-client-ui-conversation": "0.1.7-rc.1",
8315
- "@deepseek-ai/dsh-llm": "0.1.7-rc.1",
8316
- "@deepseek-ai/dsh-native-command": "0.1.7-rc.1",
8317
- "@deepseek-ai/dsh-session": "0.1.7-rc.1",
8318
- "@deepseek-ai/dsh-settings": "0.1.7-rc.1",
8319
- "@deepseek-ai/dsh-system-prompt": "0.1.7-rc.1",
8320
- "@deepseek-ai/dsh-tools": "0.1.7-rc.1",
8321
- "@deepseek-ai/schemastery": "3.18.4"
8322
- }
8323
- },
8324
- {
8325
- cli: "0.1.7-rc.2",
8326
- versions: {
8327
- "@deepseek-ai/cordis": "4.0.4",
8328
- "@deepseek-ai/dsh-agent-default-model": "0.1.7-rc.2",
8329
- "@deepseek-ai/dsh-client-ui-conversation": "0.1.7-rc.2",
8330
- "@deepseek-ai/dsh-llm": "0.1.7-rc.2",
8331
- "@deepseek-ai/dsh-native-command": "0.1.7-rc.2",
8332
- "@deepseek-ai/dsh-session": "0.1.7-rc.2",
8333
- "@deepseek-ai/dsh-settings": "0.1.7-rc.2",
8334
- "@deepseek-ai/dsh-system-prompt": "0.1.7-rc.2",
8335
- "@deepseek-ai/dsh-tools": "0.1.7-rc.2",
8336
- "@deepseek-ai/schemastery": "3.18.4"
8337
- }
8338
- }
8339
- ];
8340
8264
  var STRATAGATE_MESSAGE_SOURCE_KIND = "plugin:stratagate-memory";
8341
- function isDsh020Version(version) {
8342
- const match = /^0\.2\.0(?:-([0-9A-Za-z.-]+))?(?:\+([0-9A-Za-z.-]+))?$/.exec(version);
8343
- if (!match) return false;
8344
- const prerelease = match[1]?.split(".") ?? [];
8345
- const build = match[2]?.split(".") ?? [];
8346
- return [...prerelease, ...build].every((part) => part.length > 0) && prerelease.every((part) => !/^\d+$/.test(part) || part === "0" || !part.startsWith("0"));
8265
+ var DSH_RUNTIME_RANGE = "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0";
8266
+ var MODERN_API_RANGE = ">=0.1.7-rc.1";
8267
+ var SESSION_FORMAT_RUNTIME_RANGE = ">=0.2.0-0";
8268
+ var SEMVER_OPTIONS = { includePrerelease: true };
8269
+ function assertDshMethods(scope, value, methods) {
8270
+ const target = value;
8271
+ const missing = methods.filter((method) => typeof target?.[method] !== "function");
8272
+ if (missing.length) {
8273
+ throw new Error(`StrataGate cannot use this DSH host: missing required interface ${missing.map((method) => `${scope}.${method}`).join(", ")}. Use a compatible host or plugin version.`);
8274
+ }
8275
+ }
8276
+ function assertDshHostContract(ctx) {
8277
+ assertDshMethods("tools", ctx.tools, ["register", "get"]);
8278
+ assertDshMethods("systemPrompt", ctx.systemPrompt, ["section"]);
8279
+ assertDshMethods("llm", ctx.llm, ["stream", "listProviders"]);
8280
+ assertDshMethods("agentDefaultModel", ctx.agentDefaultModel, ["currentSelection"]);
8347
8281
  }
8348
8282
  function buildDshMessageSource(version, form) {
8349
- const source = /^0\.1\.7(?:-|$)/.test(version) || isDsh020Version(version) ? { kind: STRATAGATE_MESSAGE_SOURCE_KIND } : { kind: "plugin", plugin: "stratagate-memory" };
8283
+ const source = satisfies(version, MODERN_API_RANGE, SEMVER_OPTIONS) ? { kind: STRATAGATE_MESSAGE_SOURCE_KIND } : { kind: "plugin", plugin: "stratagate-memory" };
8350
8284
  return form ? { ...source, form } : source;
8351
8285
  }
8352
8286
  function installedVersion(packageName) {
@@ -8377,17 +8311,17 @@ function isCompatiblePatch(version, major, minor, minimumPatch) {
8377
8311
  return !!match && Number(match[1]) === major && Number(match[2]) === minor && Number(match[3]) >= minimumPatch;
8378
8312
  }
8379
8313
  function classifyDshRuntime(packageVersions) {
8380
- const family = SUPPORTED_RUNTIME_FAMILIES.find(({ versions }) => CORE_RUNTIME_PACKAGES.every((name2) => packageVersions[name2] === versions[name2]));
8381
- if (family) return { cliVersion: family.cli, packageVersions };
8382
8314
  const dshVersion = packageVersions["@deepseek-ai/dsh-session"];
8383
8315
  const sameDshFamily = CORE_RUNTIME_PACKAGES.filter((name2) => name2.startsWith("@deepseek-ai/dsh-")).every((name2) => packageVersions[name2] === dshVersion);
8384
- const sameSessionFormatFamily = !isDsh020Version(dshVersion) || SESSION_FORMAT_PACKAGES.every((name2) => packageVersions[name2] === dshVersion);
8385
- if ((/^0\.1\.7-rc\.[1-9]\d*$/.test(dshVersion) || dshVersion === "0.1.7" || isDsh020Version(dshVersion)) && sameDshFamily && sameSessionFormatFamily && isCompatiblePatch(packageVersions["@deepseek-ai/cordis"], 4, 0, 4) && isCompatiblePatch(packageVersions["@deepseek-ai/schemastery"], 3, 18, 4)) {
8386
- return { cliVersion: dshVersion, packageVersions };
8316
+ const sameSessionFormatFamily = !satisfies(dshVersion, SESSION_FORMAT_RUNTIME_RANGE, SEMVER_OPTIONS) || SESSION_FORMAT_PACKAGES.every((name2) => packageVersions[name2] === dshVersion);
8317
+ const modernApi = satisfies(dshVersion, MODERN_API_RANGE, SEMVER_OPTIONS);
8318
+ const compatibleVendors = modernApi ? isCompatiblePatch(packageVersions["@deepseek-ai/cordis"], 4, 0, 4) && isCompatiblePatch(packageVersions["@deepseek-ai/schemastery"], 3, 18, 4) : packageVersions["@deepseek-ai/cordis"] === "4.0.2" && packageVersions["@deepseek-ai/schemastery"] === "3.18.2";
8319
+ if (satisfies(dshVersion, DSH_RUNTIME_RANGE, SEMVER_OPTIONS) && sameDshFamily && sameSessionFormatFamily && compatibleVendors) {
8320
+ return { cliVersion: dshVersion === "0.1.5-rc.2" ? "0.1.5-rc.1" : dshVersion, packageVersions };
8387
8321
  }
8388
8322
  const found = RUNTIME_PACKAGES.map((name2) => `${name2}@${packageVersions[name2]}`).join(", ");
8389
8323
  throw new Error(
8390
- `StrataGate cannot start because this DSH profile resolves an unsupported or mixed core runtime. Resolved: ${found}. Supported hosts are @deepseek-ai/dsh@0.1.2-rc.1 (internal DSH packages 0.1.2-rc.1) and @deepseek-ai/dsh@0.1.5-rc.1 (its real dependency tree uses internal DSH packages 0.1.5-rc.2), and @deepseek-ai/dsh@0.1.6-alpha.1 (internal DSH packages 0.1.6-alpha.1), and the coherent DSH 0.1.7 family from rc.1 through the 0.1.7 release, and the complete DSH 0.2.0 family (all alpha, beta, rc, and stable versions; >=0.2.0-0 <0.2.1-0) (Cordis 4.0.x from 4.0.4, Schemastery 3.18.x from 3.18.4). Reinstall or update stratagate-dsh through \`dsh plugin --profile <name> add <package>\` so the host supplies its peers.`
8324
+ `StrataGate cannot start because this DSH profile resolves an unsupported or mixed core runtime. Resolved: ${found}. Supported DSH versions: ${DSH_RUNTIME_RANGE} (including prereleases). Core DSH packages must share one version; DSH 0.2.0 and later also require matching Session Format packages. Modern hosts require Cordis 4.0.x from 4.0.4 and Schemastery 3.18.x from 3.18.4; older hosts use 4.0.2 and 3.18.2. Reinstall or update stratagate-dsh through \`dsh plugin --profile <name> add <package>\` so the host supplies its peers.`
8391
8325
  );
8392
8326
  }
8393
8327
  function assertCompatibleDshRuntime() {
@@ -15956,6 +15890,13 @@ var V0_ZSTD = "session.jsonl.zstd";
15956
15890
  var V1_PLAIN = "session.v1.jsonl";
15957
15891
  var V1_ZSTD = "session.v1.jsonl.zstd";
15958
15892
  var RECEIPT_FILENAME = "stratagate-legacy-citations-v1.json";
15893
+ function assertDshMigrationContract(value) {
15894
+ const modules = value;
15895
+ assertDshMethods("releasedV0SessionFormatCodec", modules?.releasedV0SessionFormatCodec, ["createDecoder"]);
15896
+ assertDshMethods("releasedV1SessionFormatCodec", modules?.releasedV1SessionFormatCodec, ["decodeHeader", "createDecoder"]);
15897
+ assertDshMethods("sessionFormatV0ToV1", modules?.sessionFormatV0ToV1, ["migrateHeader", "createStage", "validateTargetHeader"]);
15898
+ assertDshMethods("sessionFormat", modules, ["restoreReleasedV1Artifact"]);
15899
+ }
15959
15900
  function errorText(error) {
15960
15901
  return error instanceof Error ? error.message : String(error);
15961
15902
  }
@@ -16128,6 +16069,7 @@ function prepareLegacyCitationGeneration(sourceBytes, compression, modules) {
16128
16069
  async function loadMigrationModules() {
16129
16070
  try {
16130
16071
  const edge = await import("@deepseek-ai/dsh-session-format-v0-to-v1");
16072
+ assertDshMigrationContract(edge);
16131
16073
  return {
16132
16074
  releasedV0SessionFormatCodec: edge.releasedV0SessionFormatCodec,
16133
16075
  releasedV1SessionFormatCodec: edge.releasedV1SessionFormatCodec,
@@ -16303,6 +16245,7 @@ function feedbackWebOrigin(ctx) {
16303
16245
  }
16304
16246
  async function apply(ctx, config) {
16305
16247
  const compatibility = assertCompatibleDshRuntime();
16248
+ assertDshHostContract(ctx);
16306
16249
  const resolved = resolveConfig(config);
16307
16250
  const legacyMigration = await migrateLegacyCitationSessions(resolved.sessionRoot);
16308
16251
  if (legacyMigration.failures.length > 0) {