dsh-agent-team-presets 0.3.1 → 0.3.2
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/NOTICE +6 -4
- package/README.md +18 -11
- package/README.zh.md +17 -10
- package/assets/card-patches/catalog.json +25 -0
- package/assets/card-patches/dsh-better-sidebar-0.32.1.client.js.gz +0 -0
- package/assets/card-patches/dsh-context-0.84.1.client.js.gz +0 -0
- package/lib/client.js +62 -11
- package/lib/index.js +224 -19
- package/lib/typert.host.js +16 -3
- package/lib/typert.remote-client.d.ts.map +1 -1
- package/lib/typert.remote-client.js +16 -3
- package/lib/types/builtin-skill.js +1 -1
- package/lib/types/builtin-teams.d.ts +14 -0
- package/lib/types/builtin-teams.js +18 -0
- package/lib/types/card-patches.d.ts +71 -4
- package/lib/types/card-patches.js +222 -6
- package/lib/types/client/CardPatchView.js +14 -2
- package/lib/types/client/TeamListView.d.ts +5 -0
- package/lib/types/client/TeamListView.js +1 -1
- package/lib/types/client/TeamPresetsSection.js +7 -1
- package/lib/types/client/card-patches-controller.js +16 -5
- package/lib/types/client/locales.d.ts +1 -1
- package/lib/types/client/locales.js +2 -0
- package/lib/types/settings-reconcile.js +9 -1
- package/lib/types/tool-catalog.js +12 -10
- package/lib/types/types.d.ts +5 -1
- package/package.json +56 -51
package/lib/index.js
CHANGED
|
@@ -1743,7 +1743,7 @@ Team Skill 排查:
|
|
|
1743
1743
|
|
|
1744
1744
|
## 9. 安装 / 升级 / 版本
|
|
1745
1745
|
|
|
1746
|
-
- 本版本要求 DSH >=0.2.2-rc.
|
|
1746
|
+
- 本版本要求 DSH >=0.2.2-rc.3 <0.3.0;更旧的宿主请保留 0.1.8。安装前核对 engines.dsh。
|
|
1747
1747
|
- 通过官方插件管理器安装/升级;仓库包含预构建产物,通常无需构建。
|
|
1748
1748
|
- 安装失败时不要只看版本号:核对 application 结果、warnings、保存的 package source、已安装文件哈希、是否需要重启。
|
|
1749
1749
|
- 失败的安装可能让 node_modules 比保存的依赖规格更新;这是未完成状态,不要据此宣称升级成功。解决包管理器策略后重试,并再次核对保存的 source 与运行版本。
|
|
@@ -8479,6 +8479,24 @@ function seedBuiltinTeams(teams, seeded) {
|
|
|
8479
8479
|
changed: install.length > 0 || mark.length > 0
|
|
8480
8480
|
};
|
|
8481
8481
|
}
|
|
8482
|
+
/**
|
|
8483
|
+
* The shipped presets a deployment was offered but no longer holds.
|
|
8484
|
+
*
|
|
8485
|
+
* The marker exists so a deleted preset stays deleted, which also means a Team
|
|
8486
|
+
* list that lost its shipped presets for any other reason — a hand edit, a
|
|
8487
|
+
* restored settings file, a rollback — never gets them back on its own. This
|
|
8488
|
+
* reads that state instead of changing it: the caller warns, and the reader can
|
|
8489
|
+
* decide to restore. A preset the deployment was never offered is not reported,
|
|
8490
|
+
* because the install pass will add it on this same startup.
|
|
8491
|
+
* @param teams - the stored Team list.
|
|
8492
|
+
* @param seeded - identities the deployment was already offered.
|
|
8493
|
+
* @returns the shipped identities that are marked as offered yet absent.
|
|
8494
|
+
*/
|
|
8495
|
+
function missingSeededBuiltinTeams(teams, seeded) {
|
|
8496
|
+
const held = new Set(teams.map((team) => team.id));
|
|
8497
|
+
const known = new Set(seeded);
|
|
8498
|
+
return BUILTIN_TEAMS.filter((entry) => known.has(entry.id) && !held.has(entry.id)).map((entry) => entry.id);
|
|
8499
|
+
}
|
|
8482
8500
|
|
|
8483
8501
|
|
|
8484
8502
|
/**
|
|
@@ -8711,6 +8729,8 @@ function teamSettingsReconcile(ctx, config, namespace) {
|
|
|
8711
8729
|
return nextTeam;
|
|
8712
8730
|
});
|
|
8713
8731
|
const installed = seedBuiltinTeams(cleaned, seeded);
|
|
8732
|
+
const missingShipped = missingSeededBuiltinTeams(installed.teams, installed.seeded);
|
|
8733
|
+
if (missingShipped.length > 0) ctx.logger.warn("agent-team-presets: %d shipped Team preset(s) are marked as offered but missing from the Team list (%s); open Settings → Agent Team presets and click \"Restore built-in presets\", then save", missingShipped.length, missingShipped.join(", "));
|
|
8714
8734
|
const live = reconciledAssignments(categories, installed.teams, teamCategories);
|
|
8715
8735
|
const categoriesChanged = live.length !== teamCategories.length;
|
|
8716
8736
|
if (categoriesChanged) ctx.logger.info("agent-team-presets: dropped %d category membership(s) whose category or custom Team no longer exists", teamCategories.length - live.length);
|
|
@@ -19711,13 +19731,15 @@ function registerTeamSkillTools(ctx, agent, deps) {
|
|
|
19711
19731
|
* @module dsh-agent-team-presets/card-patches
|
|
19712
19732
|
*/
|
|
19713
19733
|
/**
|
|
19714
|
-
* The
|
|
19734
|
+
* The versions compiled into this build.
|
|
19715
19735
|
*
|
|
19716
|
-
* Each entry is
|
|
19717
|
-
*
|
|
19718
|
-
*
|
|
19736
|
+
* Each entry is a finished artifact: the replacement is a whole-bundle build, so
|
|
19737
|
+
* a different version's bundle would silently change behaviour that was never
|
|
19738
|
+
* reviewed here. Newer versions are added by `tools/card-patches.mjs`, which
|
|
19739
|
+
* verifies the rebuild first and then writes them to the shipped catalog
|
|
19740
|
+
* overlay; nothing here needs to change for that.
|
|
19719
19741
|
*/
|
|
19720
|
-
const
|
|
19742
|
+
const COMPILED_TARGETS = [{
|
|
19721
19743
|
id: "dsh-context",
|
|
19722
19744
|
packageName: "dsh-context",
|
|
19723
19745
|
version: "0.84.0",
|
|
@@ -19736,6 +19758,119 @@ const CARD_PATCH_TARGETS = [{
|
|
|
19736
19758
|
pristineSha256: "30d0022f89c0bc4751fe6cf274cb7f3543389c27ad18ebf4e58fac4a40ad7cc4",
|
|
19737
19759
|
patchedSha256: "d0a9f0257e80fb3fdf6eb06a587b5b5aa985e1cfbaaf7a187ee381da0a8ac7ba"
|
|
19738
19760
|
}];
|
|
19761
|
+
/** The shipped overlay: entries a build produced for versions this code predates. */
|
|
19762
|
+
function shippedCatalogFile() {
|
|
19763
|
+
return join(shippedAssets(), "catalog.json");
|
|
19764
|
+
}
|
|
19765
|
+
/** One validated overlay entry, or a message naming what is wrong with it. */
|
|
19766
|
+
function catalogString(row, field, pattern, hint) {
|
|
19767
|
+
const value = row[field];
|
|
19768
|
+
if (typeof value !== "string" || !pattern.test(value)) throw new Error(`${field} ${hint}: ${JSON.stringify(value)}`);
|
|
19769
|
+
return value;
|
|
19770
|
+
}
|
|
19771
|
+
/**
|
|
19772
|
+
* Validate one overlay entry.
|
|
19773
|
+
*
|
|
19774
|
+
* The overlay is data, not code, so it may be edited by hand or written by an
|
|
19775
|
+
* older tool; every field is checked against the same shape the compiled
|
|
19776
|
+
* entries use. An entry that fails is a reason to ignore the whole document,
|
|
19777
|
+
* because acting on part of it would make "what does this build support"
|
|
19778
|
+
* depend on JSON key order.
|
|
19779
|
+
* @param candidate - one parsed entry.
|
|
19780
|
+
* @returns the normalized target.
|
|
19781
|
+
* @throws when any field is unusable.
|
|
19782
|
+
*/
|
|
19783
|
+
function normalizeCatalogTarget(candidate) {
|
|
19784
|
+
if (candidate === null || typeof candidate !== "object" || Array.isArray(candidate)) throw new Error("the entry is not an object");
|
|
19785
|
+
const row = candidate;
|
|
19786
|
+
const pristineSha256 = catalogString(row, "pristineSha256", /^[0-9a-f]{64}$/, "must be 64 lowercase hex characters");
|
|
19787
|
+
const patchedSha256 = catalogString(row, "patchedSha256", /^[0-9a-f]{64}$/, "must be 64 lowercase hex characters");
|
|
19788
|
+
if (pristineSha256 === patchedSha256) throw new Error("pristineSha256 and patchedSha256 must differ, or the replacement would be the published build");
|
|
19789
|
+
const source = row["source"];
|
|
19790
|
+
if (typeof source !== "string" || source.trim() === "" || /\s/.test(source)) throw new Error(`source must be one non-empty token: ${JSON.stringify(source)}`);
|
|
19791
|
+
return {
|
|
19792
|
+
id: catalogString(row, "id", /^[a-z0-9]+(?:-[a-z0-9]+)*$/, "must be lowercase words joined by hyphens"),
|
|
19793
|
+
packageName: catalogString(row, "packageName", /^[a-z0-9][a-z0-9._-]*$/, "must be a bare package name"),
|
|
19794
|
+
version: catalogString(row, "version", /^\d+\.\d+\.\d+(?:-[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?$/, "must be a semver version"),
|
|
19795
|
+
source,
|
|
19796
|
+
asset: catalogString(row, "asset", /^[a-z0-9][a-z0-9._-]*\.client\.js\.gz$/, "must be a bare `<name>.client.js.gz` file name"),
|
|
19797
|
+
service: catalogString(row, "service", /^[A-Za-z_$][A-Za-z0-9_$]*$/, "must be a JavaScript identifier"),
|
|
19798
|
+
pristineSha256,
|
|
19799
|
+
patchedSha256
|
|
19800
|
+
};
|
|
19801
|
+
}
|
|
19802
|
+
/**
|
|
19803
|
+
* Parse a shipped catalog overlay document.
|
|
19804
|
+
* @param text - the document text.
|
|
19805
|
+
* @returns every entry it declares.
|
|
19806
|
+
* @throws when the document or any entry is unusable.
|
|
19807
|
+
*/
|
|
19808
|
+
function parseCardPatchCatalog(text) {
|
|
19809
|
+
const document = JSON.parse(text);
|
|
19810
|
+
if (document === null || typeof document !== "object" || Array.isArray(document)) throw new Error("the catalog is not an object");
|
|
19811
|
+
const version = document.version;
|
|
19812
|
+
if (version !== 1) throw new Error(`the catalog version is ${JSON.stringify(version)}, not 1`);
|
|
19813
|
+
const targets = document.targets;
|
|
19814
|
+
if (!Array.isArray(targets)) throw new Error("the catalog has no targets array");
|
|
19815
|
+
return targets.map(normalizeCatalogTarget);
|
|
19816
|
+
}
|
|
19817
|
+
/**
|
|
19818
|
+
* Combine the compiled baseline with the shipped overlay.
|
|
19819
|
+
*
|
|
19820
|
+
* Entries are keyed by identity *and* version, not by identity alone: keeping
|
|
19821
|
+
* the already-supported versions is the whole point of shipping a replacement
|
|
19822
|
+
* per version, so rebuilding 0.84.1 must not drop 0.84.0 for the installations
|
|
19823
|
+
* still on it. Only the exact pair is replaced when the same version is rebuilt.
|
|
19824
|
+
* Compiled order is kept, because that is the order the settings page lists.
|
|
19825
|
+
* @param baseline - entries compiled into this build.
|
|
19826
|
+
* @param overlay - entries read from the shipped catalog.
|
|
19827
|
+
* @returns the merged catalog.
|
|
19828
|
+
*/
|
|
19829
|
+
function mergeCatalogTargets(baseline, overlay) {
|
|
19830
|
+
const key = (entry) => `${entry.id}@${entry.version}`;
|
|
19831
|
+
const byKey = new Map(overlay.map((entry) => [key(entry), entry]));
|
|
19832
|
+
const merged = baseline.map((entry) => byKey.get(key(entry)) ?? entry);
|
|
19833
|
+
const order = { numeric: true };
|
|
19834
|
+
for (const [entryKey, entry] of [...byKey].sort(([left], [right]) => left.localeCompare(right, "en", order))) if (!baseline.some((current) => key(current) === entryKey)) merged.push(entry);
|
|
19835
|
+
return merged;
|
|
19836
|
+
}
|
|
19837
|
+
/**
|
|
19838
|
+
* The distinct target identities, in catalog order.
|
|
19839
|
+
* @param targets - the catalog to read.
|
|
19840
|
+
* @returns one identity per target, first occurrence order.
|
|
19841
|
+
*/
|
|
19842
|
+
function catalogIdentities(targets = CARD_PATCH_TARGETS) {
|
|
19843
|
+
return [...new Set(targets.map((target) => target.id))];
|
|
19844
|
+
}
|
|
19845
|
+
/**
|
|
19846
|
+
* Every catalog entry for one identity.
|
|
19847
|
+
* @param id - the target identity.
|
|
19848
|
+
* @param targets - the catalog to read.
|
|
19849
|
+
* @returns its entries, oldest build first.
|
|
19850
|
+
*/
|
|
19851
|
+
function catalogTargetsFor(id, targets = CARD_PATCH_TARGETS) {
|
|
19852
|
+
return targets.filter((target) => target.id === id);
|
|
19853
|
+
}
|
|
19854
|
+
/**
|
|
19855
|
+
* Read the shipped overlay, or nothing when it is absent or unusable.
|
|
19856
|
+
*
|
|
19857
|
+
* A broken overlay must not take the whole settings page down: it is optional
|
|
19858
|
+
* data, so a refusal here falls back to the versions compiled into this build
|
|
19859
|
+
* and says so in the log.
|
|
19860
|
+
* @returns the overlay entries.
|
|
19861
|
+
*/
|
|
19862
|
+
function readShippedCatalog() {
|
|
19863
|
+
const file = shippedCatalogFile();
|
|
19864
|
+
if (!existsSync(file)) return [];
|
|
19865
|
+
try {
|
|
19866
|
+
return parseCardPatchCatalog(readFileSync(file, "utf8"));
|
|
19867
|
+
} catch (error) {
|
|
19868
|
+
console.warn(`[team-presets] ignoring the shipped card-patch catalog: ${error instanceof Error ? error.message : String(error)}`);
|
|
19869
|
+
return [];
|
|
19870
|
+
}
|
|
19871
|
+
}
|
|
19872
|
+
/** Every version this build can patch: the compiled baseline plus the overlay. */
|
|
19873
|
+
const CARD_PATCH_TARGETS = mergeCatalogTargets(COMPILED_TARGETS, readShippedCatalog());
|
|
19739
19874
|
/** Directory holding the prebuilt replacements shipped with this package. */
|
|
19740
19875
|
function shippedAssets() {
|
|
19741
19876
|
return join(dirname(dirname(fileURLToPath(import.meta.url))), "assets", "card-patches");
|
|
@@ -19806,7 +19941,9 @@ function targetState(target, env = realCardPatchEnvironment) {
|
|
|
19806
19941
|
id: target.id,
|
|
19807
19942
|
packageName: target.packageName,
|
|
19808
19943
|
source: target.source,
|
|
19809
|
-
|
|
19944
|
+
service: target.service,
|
|
19945
|
+
supportedVersion: target.version,
|
|
19946
|
+
supportedVersions: [target.version]
|
|
19810
19947
|
};
|
|
19811
19948
|
const directory = env.resolvePackage(target.packageName);
|
|
19812
19949
|
if (directory === void 0) return {
|
|
@@ -19993,12 +20130,80 @@ function uninstallCardPatch(target, env = realCardPatchEnvironment) {
|
|
|
19993
20130
|
};
|
|
19994
20131
|
}
|
|
19995
20132
|
/**
|
|
19996
|
-
*
|
|
19997
|
-
*
|
|
19998
|
-
*
|
|
20133
|
+
* Classify one identity by the version that is actually installed.
|
|
20134
|
+
*
|
|
20135
|
+
* Several catalog entries may exist for the same target, one per supported
|
|
20136
|
+
* upstream version; which one is relevant depends entirely on the installed
|
|
20137
|
+
* package, so the choice belongs here rather than at each call site. A version
|
|
20138
|
+
* this build has no replacement for reports `unsupported` and names the
|
|
20139
|
+
* versions it does ship, which is what tells an operator whether to update the
|
|
20140
|
+
* target plugin or this one.
|
|
20141
|
+
* @param entries - every catalog entry for one identity, oldest first.
|
|
20142
|
+
* @param env - the file-system facts to read through.
|
|
20143
|
+
* @returns the row the settings page renders.
|
|
19999
20144
|
*/
|
|
20000
|
-
function
|
|
20001
|
-
|
|
20145
|
+
function resolveTargetView(entries, env = realCardPatchEnvironment) {
|
|
20146
|
+
const newest = entries.at(-1);
|
|
20147
|
+
if (newest === void 0) throw new Error("a card-patch target needs at least one catalog entry");
|
|
20148
|
+
const supportedVersions = entries.map((entry) => entry.version);
|
|
20149
|
+
const base = {
|
|
20150
|
+
id: newest.id,
|
|
20151
|
+
packageName: newest.packageName,
|
|
20152
|
+
source: newest.source,
|
|
20153
|
+
service: newest.service,
|
|
20154
|
+
supportedVersion: newest.version,
|
|
20155
|
+
supportedVersions
|
|
20156
|
+
};
|
|
20157
|
+
const directory = env.resolvePackage(newest.packageName);
|
|
20158
|
+
if (directory === void 0) return {
|
|
20159
|
+
...base,
|
|
20160
|
+
state: "absent",
|
|
20161
|
+
detail: "this plugin is not installed in the running profile"
|
|
20162
|
+
};
|
|
20163
|
+
const installed = installedVersion(directory);
|
|
20164
|
+
if (installed === void 0) return {
|
|
20165
|
+
...base,
|
|
20166
|
+
state: "absent",
|
|
20167
|
+
detail: "its package.json could not be read"
|
|
20168
|
+
};
|
|
20169
|
+
const target = entries.find((entry) => entry.version === installed);
|
|
20170
|
+
if (target === void 0) return {
|
|
20171
|
+
...base,
|
|
20172
|
+
installedVersion: installed,
|
|
20173
|
+
state: "unsupported",
|
|
20174
|
+
detail: `this build ships a replacement for ${supportedVersions.join(", ")}, not ${installed}`
|
|
20175
|
+
};
|
|
20176
|
+
return {
|
|
20177
|
+
...targetState(target, env),
|
|
20178
|
+
supportedVersions
|
|
20179
|
+
};
|
|
20180
|
+
}
|
|
20181
|
+
/**
|
|
20182
|
+
* Resolve the catalog entry that matches the installed version of one target.
|
|
20183
|
+
* @param id - the target identity.
|
|
20184
|
+
* @param env - the file-system facts to read through.
|
|
20185
|
+
* @param targets - the catalog to read.
|
|
20186
|
+
* @returns the entry to patch, when this build has one for that exact version.
|
|
20187
|
+
*/
|
|
20188
|
+
function resolveInstalledTarget(id, env = realCardPatchEnvironment, targets = CARD_PATCH_TARGETS) {
|
|
20189
|
+
const entries = catalogTargetsFor(id, targets);
|
|
20190
|
+
if (entries.length === 0) return { view: {
|
|
20191
|
+
id,
|
|
20192
|
+
packageName: id,
|
|
20193
|
+
source: "unknown",
|
|
20194
|
+
service: id,
|
|
20195
|
+
supportedVersion: "",
|
|
20196
|
+
supportedVersions: [],
|
|
20197
|
+
state: "absent",
|
|
20198
|
+
detail: `this build ships no card patch for "${id}"`
|
|
20199
|
+
} };
|
|
20200
|
+
const view = resolveTargetView(entries, env);
|
|
20201
|
+
if (view.state === "absent" || view.state === "unsupported") return { view };
|
|
20202
|
+
const target = entries.find((entry) => entry.version === view.supportedVersion);
|
|
20203
|
+
return target === void 0 ? { view } : {
|
|
20204
|
+
target,
|
|
20205
|
+
view
|
|
20206
|
+
};
|
|
20002
20207
|
}
|
|
20003
20208
|
|
|
20004
20209
|
|
|
@@ -20352,7 +20557,7 @@ let TeamPresetsToolCatalog = (() => {
|
|
|
20352
20557
|
* @returns one row per supported target, in catalog order.
|
|
20353
20558
|
*/
|
|
20354
20559
|
async cardPatches() {
|
|
20355
|
-
return
|
|
20560
|
+
return catalogIdentities().map((id) => resolveTargetView(catalogTargetsFor(id), this.cardPatchEnvironment));
|
|
20356
20561
|
}
|
|
20357
20562
|
/**
|
|
20358
20563
|
* Replace one target's browser bundle with this build's prebuilt replacement.
|
|
@@ -20360,12 +20565,12 @@ let TeamPresetsToolCatalog = (() => {
|
|
|
20360
20565
|
* @returns the outcome, or a refusal naming why nothing changed.
|
|
20361
20566
|
*/
|
|
20362
20567
|
async installCardPatch(id) {
|
|
20363
|
-
const target =
|
|
20568
|
+
const { target, view } = resolveInstalledTarget(id, this.cardPatchEnvironment);
|
|
20364
20569
|
if (target === void 0) return {
|
|
20365
20570
|
ok: false,
|
|
20366
20571
|
id,
|
|
20367
|
-
state:
|
|
20368
|
-
detail
|
|
20572
|
+
state: view.state,
|
|
20573
|
+
...view.detail === void 0 ? {} : { detail: view.detail }
|
|
20369
20574
|
};
|
|
20370
20575
|
const result = installCardPatch(target, this.cardPatchEnvironment);
|
|
20371
20576
|
if (result.ok) this.publishClientBundle(target.packageName);
|
|
@@ -20377,12 +20582,12 @@ let TeamPresetsToolCatalog = (() => {
|
|
|
20377
20582
|
* @returns the outcome, or a refusal naming why nothing changed.
|
|
20378
20583
|
*/
|
|
20379
20584
|
async uninstallCardPatch(id) {
|
|
20380
|
-
const target =
|
|
20585
|
+
const { target, view } = resolveInstalledTarget(id, this.cardPatchEnvironment);
|
|
20381
20586
|
if (target === void 0) return {
|
|
20382
20587
|
ok: false,
|
|
20383
20588
|
id,
|
|
20384
|
-
state:
|
|
20385
|
-
detail
|
|
20589
|
+
state: view.state,
|
|
20590
|
+
...view.detail === void 0 ? {} : { detail: view.detail }
|
|
20386
20591
|
};
|
|
20387
20592
|
const result = uninstallCardPatch(target, this.cardPatchEnvironment);
|
|
20388
20593
|
if (result.ok) this.publishClientBundle(target.packageName);
|
package/lib/typert.host.js
CHANGED
|
@@ -19017,7 +19017,9 @@ const dsh_agent_team_presets_teamPresets_cardPatches_result$schema = () => dsh_a
|
|
|
19017
19017
|
"id": string$1().readonly().describe("Stable identity."),
|
|
19018
19018
|
"packageName": string$1().readonly().describe("Package the row is about."),
|
|
19019
19019
|
"source": string$1().readonly().describe("Upstream revision the prebuilt replacement came from."),
|
|
19020
|
-
"
|
|
19020
|
+
"service": string$1().readonly().describe("Service a patched target registers; the page reads it to tell \"active\" from \"installed\"."),
|
|
19021
|
+
"supportedVersion": string$1().readonly().describe("The version whose replacement applies to this row (the newest supported one when none matches)."),
|
|
19022
|
+
"supportedVersions": array(string$1()).readonly().describe("Every upstream version this build ships a replacement for."),
|
|
19021
19023
|
"installedVersion": string$1().readonly().optional().describe("Installed version, when the package is present."),
|
|
19022
19024
|
"state": union([
|
|
19023
19025
|
literal("absent"),
|
|
@@ -19825,9 +19827,18 @@ const $remote = createTypertRemoteInfo({
|
|
|
19825
19827
|
"type": "string",
|
|
19826
19828
|
"description": "Upstream revision the prebuilt replacement came from."
|
|
19827
19829
|
},
|
|
19830
|
+
"service": {
|
|
19831
|
+
"type": "string",
|
|
19832
|
+
"description": "Service a patched target registers; the page reads it to tell \"active\" from \"installed\"."
|
|
19833
|
+
},
|
|
19828
19834
|
"supportedVersion": {
|
|
19829
19835
|
"type": "string",
|
|
19830
|
-
"description": "The version this
|
|
19836
|
+
"description": "The version whose replacement applies to this row (the newest supported one when none matches)."
|
|
19837
|
+
},
|
|
19838
|
+
"supportedVersions": {
|
|
19839
|
+
"type": "array",
|
|
19840
|
+
"items": { "type": "string" },
|
|
19841
|
+
"description": "Every upstream version this build ships a replacement for."
|
|
19831
19842
|
},
|
|
19832
19843
|
"installedVersion": {
|
|
19833
19844
|
"type": "string",
|
|
@@ -19853,7 +19864,9 @@ const $remote = createTypertRemoteInfo({
|
|
|
19853
19864
|
"id",
|
|
19854
19865
|
"packageName",
|
|
19855
19866
|
"source",
|
|
19867
|
+
"service",
|
|
19856
19868
|
"supportedVersion",
|
|
19869
|
+
"supportedVersions",
|
|
19857
19870
|
"state"
|
|
19858
19871
|
],
|
|
19859
19872
|
"additionalProperties": true
|
|
@@ -20061,7 +20074,7 @@ const $remote = createTypertRemoteInfo({
|
|
|
20061
20074
|
},
|
|
20062
20075
|
sourceLocation: {
|
|
20063
20076
|
"file": "packages/experimental/agent-team-presets/src/tool-catalog.ts",
|
|
20064
|
-
"line":
|
|
20077
|
+
"line": 274,
|
|
20065
20078
|
"column": 9
|
|
20066
20079
|
}
|
|
20067
20080
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typert.remote-client.d.ts","names":["cardPatches","catalog","execution","installCardPatch","isPresetMember","roster","uninstallCardPatch","assignRole","createSkill","deleteAsset","detail","importSkill","library","overrideSkill","prepareImportFolder","readFile","resetSkill","restoreBuiltinBindings","scanImportFolder","unassignRole","updateDependencies","writeFile"],"sources":["../src/tool-catalog.ts","../src/team-skills/service.ts"],"sourcesContent":[null,null],"mappings":";;;;;;;;;;;IAqQQA,W;IAnGAC,O;IAwINC,S;
|
|
1
|
+
{"version":3,"file":"typert.remote-client.d.ts","names":["cardPatches","catalog","execution","installCardPatch","isPresetMember","roster","uninstallCardPatch","assignRole","createSkill","deleteAsset","detail","importSkill","library","overrideSkill","prepareImportFolder","readFile","resetSkill","restoreBuiltinBindings","scanImportFolder","unassignRole","updateDependencies","writeFile"],"sources":["../src/tool-catalog.ts","../src/team-skills/service.ts"],"sourcesContent":[null,null],"mappings":";;;;;;;;;;;IAqQQA,W;IAnGAC,O;IAwINC,S;IAzBMC,gB;IA7CAC,c;IAVAC,M;IAqEAC,kB;;;ICiJAC,U;IA1MAC,W;IA6KAC,W;IAjPAC,M;IAwFAC,W;IA9GAC,O;IAuNAC,a;IA5EAC,mB;IAtFAC,Q;IAgMAC,U;IAmFAC,sB;IArKAC,gB;IAuJAC,Y;IApFAC,kB;IA/JAC,S;;;IDkDArB,yB;IAnGAC,qB;IAwINC,uB;IAzBMC,8B;IA7CAC,4B;IAVAC,oB;IAqEAC,gC;ICiJAC,uB;IA1MAC,wB;IA6KAC,wB;IAjPAC,mB;IAwFAC,wB;IA9GAC,oB;IAuNAC,0B;IA5EAC,gC;IAtFAC,qB;IAgMAC,uB;IAmFAC,mC;IArKAC,6B;IAuJAC,yB;IApFAC,+B;IA/JAC,sB","ignoreList":[]}
|
|
@@ -19017,7 +19017,9 @@ const dsh_agent_team_presets_teamPresets_cardPatches_result$schema = () => dsh_a
|
|
|
19017
19017
|
"id": string$1().readonly().describe("Stable identity."),
|
|
19018
19018
|
"packageName": string$1().readonly().describe("Package the row is about."),
|
|
19019
19019
|
"source": string$1().readonly().describe("Upstream revision the prebuilt replacement came from."),
|
|
19020
|
-
"
|
|
19020
|
+
"service": string$1().readonly().describe("Service a patched target registers; the page reads it to tell \"active\" from \"installed\"."),
|
|
19021
|
+
"supportedVersion": string$1().readonly().describe("The version whose replacement applies to this row (the newest supported one when none matches)."),
|
|
19022
|
+
"supportedVersions": array(string$1()).readonly().describe("Every upstream version this build ships a replacement for."),
|
|
19021
19023
|
"installedVersion": string$1().readonly().optional().describe("Installed version, when the package is present."),
|
|
19022
19024
|
"state": union([
|
|
19023
19025
|
literal("absent"),
|
|
@@ -19825,9 +19827,18 @@ const TYPERT_REMOTE = createTypertRemoteInfo({
|
|
|
19825
19827
|
"type": "string",
|
|
19826
19828
|
"description": "Upstream revision the prebuilt replacement came from."
|
|
19827
19829
|
},
|
|
19830
|
+
"service": {
|
|
19831
|
+
"type": "string",
|
|
19832
|
+
"description": "Service a patched target registers; the page reads it to tell \"active\" from \"installed\"."
|
|
19833
|
+
},
|
|
19828
19834
|
"supportedVersion": {
|
|
19829
19835
|
"type": "string",
|
|
19830
|
-
"description": "The version this
|
|
19836
|
+
"description": "The version whose replacement applies to this row (the newest supported one when none matches)."
|
|
19837
|
+
},
|
|
19838
|
+
"supportedVersions": {
|
|
19839
|
+
"type": "array",
|
|
19840
|
+
"items": { "type": "string" },
|
|
19841
|
+
"description": "Every upstream version this build ships a replacement for."
|
|
19831
19842
|
},
|
|
19832
19843
|
"installedVersion": {
|
|
19833
19844
|
"type": "string",
|
|
@@ -19853,7 +19864,9 @@ const TYPERT_REMOTE = createTypertRemoteInfo({
|
|
|
19853
19864
|
"id",
|
|
19854
19865
|
"packageName",
|
|
19855
19866
|
"source",
|
|
19867
|
+
"service",
|
|
19856
19868
|
"supportedVersion",
|
|
19869
|
+
"supportedVersions",
|
|
19857
19870
|
"state"
|
|
19858
19871
|
],
|
|
19859
19872
|
"additionalProperties": true
|
|
@@ -20061,7 +20074,7 @@ const TYPERT_REMOTE = createTypertRemoteInfo({
|
|
|
20061
20074
|
},
|
|
20062
20075
|
sourceLocation: {
|
|
20063
20076
|
"file": "packages/experimental/agent-team-presets/src/tool-catalog.ts",
|
|
20064
|
-
"line":
|
|
20077
|
+
"line": 274,
|
|
20065
20078
|
"column": 9
|
|
20066
20079
|
}
|
|
20067
20080
|
},
|
|
@@ -139,7 +139,7 @@ Team Skill 排查:
|
|
|
139
139
|
|
|
140
140
|
## 9. 安装 / 升级 / 版本
|
|
141
141
|
|
|
142
|
-
- 本版本要求 DSH >=0.2.2-rc.
|
|
142
|
+
- 本版本要求 DSH >=0.2.2-rc.3 <0.3.0;更旧的宿主请保留 0.1.8。安装前核对 engines.dsh。
|
|
143
143
|
- 通过官方插件管理器安装/升级;仓库包含预构建产物,通常无需构建。
|
|
144
144
|
- 安装失败时不要只看版本号:核对 application 结果、warnings、保存的 package source、已安装文件哈希、是否需要重启。
|
|
145
145
|
- 失败的安装可能让 node_modules 比保存的依赖规格更新;这是未完成状态,不要据此宣称升级成功。解决包管理器策略后重试,并再次核对保存的 source 与运行版本。
|
|
@@ -113,6 +113,20 @@ export interface BuiltinSeedResult {
|
|
|
113
113
|
* @returns the next Team list, the next marker, and whether either changed.
|
|
114
114
|
*/
|
|
115
115
|
export declare function seedBuiltinTeams(teams: readonly TeamPreset[], seeded: readonly string[]): BuiltinSeedResult;
|
|
116
|
+
/**
|
|
117
|
+
* The shipped presets a deployment was offered but no longer holds.
|
|
118
|
+
*
|
|
119
|
+
* The marker exists so a deleted preset stays deleted, which also means a Team
|
|
120
|
+
* list that lost its shipped presets for any other reason — a hand edit, a
|
|
121
|
+
* restored settings file, a rollback — never gets them back on its own. This
|
|
122
|
+
* reads that state instead of changing it: the caller warns, and the reader can
|
|
123
|
+
* decide to restore. A preset the deployment was never offered is not reported,
|
|
124
|
+
* because the install pass will add it on this same startup.
|
|
125
|
+
* @param teams - the stored Team list.
|
|
126
|
+
* @param seeded - identities the deployment was already offered.
|
|
127
|
+
* @returns the shipped identities that are marked as offered yet absent.
|
|
128
|
+
*/
|
|
129
|
+
export declare function missingSeededBuiltinTeams(teams: readonly TeamPreset[], seeded: readonly string[]): string[];
|
|
116
130
|
/**
|
|
117
131
|
* Whether two metadata objects are equal field by field.
|
|
118
132
|
* @param a - left metadata, or undefined.
|
|
@@ -146,6 +146,24 @@ export function seedBuiltinTeams(teams, seeded) {
|
|
|
146
146
|
changed: install.length > 0 || mark.length > 0,
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* The shipped presets a deployment was offered but no longer holds.
|
|
151
|
+
*
|
|
152
|
+
* The marker exists so a deleted preset stays deleted, which also means a Team
|
|
153
|
+
* list that lost its shipped presets for any other reason — a hand edit, a
|
|
154
|
+
* restored settings file, a rollback — never gets them back on its own. This
|
|
155
|
+
* reads that state instead of changing it: the caller warns, and the reader can
|
|
156
|
+
* decide to restore. A preset the deployment was never offered is not reported,
|
|
157
|
+
* because the install pass will add it on this same startup.
|
|
158
|
+
* @param teams - the stored Team list.
|
|
159
|
+
* @param seeded - identities the deployment was already offered.
|
|
160
|
+
* @returns the shipped identities that are marked as offered yet absent.
|
|
161
|
+
*/
|
|
162
|
+
export function missingSeededBuiltinTeams(teams, seeded) {
|
|
163
|
+
const held = new Set(teams.map(team => team.id));
|
|
164
|
+
const known = new Set(seeded);
|
|
165
|
+
return BUILTIN_TEAMS.filter(entry => known.has(entry.id) && !held.has(entry.id)).map(entry => entry.id);
|
|
166
|
+
}
|
|
149
167
|
/**
|
|
150
168
|
* Whether two slots carry the same stored fields.
|
|
151
169
|
* @param a - left slot.
|
|
@@ -45,13 +45,55 @@ export interface CardPatchTarget {
|
|
|
45
45
|
/** sha256 of the prebuilt replacement; the only state one may restore from. */
|
|
46
46
|
readonly patchedSha256: string;
|
|
47
47
|
}
|
|
48
|
+
/** Version of the shipped catalog overlay document; a different one is ignored. */
|
|
49
|
+
export declare const CARD_PATCH_CATALOG_VERSION = 1;
|
|
48
50
|
/**
|
|
49
|
-
*
|
|
51
|
+
* Validate one overlay entry.
|
|
50
52
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
53
|
+
* The overlay is data, not code, so it may be edited by hand or written by an
|
|
54
|
+
* older tool; every field is checked against the same shape the compiled
|
|
55
|
+
* entries use. An entry that fails is a reason to ignore the whole document,
|
|
56
|
+
* because acting on part of it would make "what does this build support"
|
|
57
|
+
* depend on JSON key order.
|
|
58
|
+
* @param candidate - one parsed entry.
|
|
59
|
+
* @returns the normalized target.
|
|
60
|
+
* @throws when any field is unusable.
|
|
54
61
|
*/
|
|
62
|
+
export declare function normalizeCatalogTarget(candidate: unknown): CardPatchTarget;
|
|
63
|
+
/**
|
|
64
|
+
* Parse a shipped catalog overlay document.
|
|
65
|
+
* @param text - the document text.
|
|
66
|
+
* @returns every entry it declares.
|
|
67
|
+
* @throws when the document or any entry is unusable.
|
|
68
|
+
*/
|
|
69
|
+
export declare function parseCardPatchCatalog(text: string): readonly CardPatchTarget[];
|
|
70
|
+
/**
|
|
71
|
+
* Combine the compiled baseline with the shipped overlay.
|
|
72
|
+
*
|
|
73
|
+
* Entries are keyed by identity *and* version, not by identity alone: keeping
|
|
74
|
+
* the already-supported versions is the whole point of shipping a replacement
|
|
75
|
+
* per version, so rebuilding 0.84.1 must not drop 0.84.0 for the installations
|
|
76
|
+
* still on it. Only the exact pair is replaced when the same version is rebuilt.
|
|
77
|
+
* Compiled order is kept, because that is the order the settings page lists.
|
|
78
|
+
* @param baseline - entries compiled into this build.
|
|
79
|
+
* @param overlay - entries read from the shipped catalog.
|
|
80
|
+
* @returns the merged catalog.
|
|
81
|
+
*/
|
|
82
|
+
export declare function mergeCatalogTargets(baseline: readonly CardPatchTarget[], overlay: readonly CardPatchTarget[]): readonly CardPatchTarget[];
|
|
83
|
+
/**
|
|
84
|
+
* The distinct target identities, in catalog order.
|
|
85
|
+
* @param targets - the catalog to read.
|
|
86
|
+
* @returns one identity per target, first occurrence order.
|
|
87
|
+
*/
|
|
88
|
+
export declare function catalogIdentities(targets?: readonly CardPatchTarget[]): readonly string[];
|
|
89
|
+
/**
|
|
90
|
+
* Every catalog entry for one identity.
|
|
91
|
+
* @param id - the target identity.
|
|
92
|
+
* @param targets - the catalog to read.
|
|
93
|
+
* @returns its entries, oldest build first.
|
|
94
|
+
*/
|
|
95
|
+
export declare function catalogTargetsFor(id: string, targets?: readonly CardPatchTarget[]): readonly CardPatchTarget[];
|
|
96
|
+
/** Every version this build can patch: the compiled baseline plus the overlay. */
|
|
55
97
|
export declare const CARD_PATCH_TARGETS: readonly CardPatchTarget[];
|
|
56
98
|
/**
|
|
57
99
|
* The file-system facts one patch operation depends on.
|
|
@@ -102,3 +144,28 @@ export declare function uninstallCardPatch(target: CardPatchTarget, env?: CardPa
|
|
|
102
144
|
* @returns the entry, or undefined for an id this build does not ship.
|
|
103
145
|
*/
|
|
104
146
|
export declare function findCardPatchTarget(id: string): CardPatchTarget | undefined;
|
|
147
|
+
/**
|
|
148
|
+
* Classify one identity by the version that is actually installed.
|
|
149
|
+
*
|
|
150
|
+
* Several catalog entries may exist for the same target, one per supported
|
|
151
|
+
* upstream version; which one is relevant depends entirely on the installed
|
|
152
|
+
* package, so the choice belongs here rather than at each call site. A version
|
|
153
|
+
* this build has no replacement for reports `unsupported` and names the
|
|
154
|
+
* versions it does ship, which is what tells an operator whether to update the
|
|
155
|
+
* target plugin or this one.
|
|
156
|
+
* @param entries - every catalog entry for one identity, oldest first.
|
|
157
|
+
* @param env - the file-system facts to read through.
|
|
158
|
+
* @returns the row the settings page renders.
|
|
159
|
+
*/
|
|
160
|
+
export declare function resolveTargetView(entries: readonly CardPatchTarget[], env?: CardPatchEnvironment): CardPatchTargetView;
|
|
161
|
+
/**
|
|
162
|
+
* Resolve the catalog entry that matches the installed version of one target.
|
|
163
|
+
* @param id - the target identity.
|
|
164
|
+
* @param env - the file-system facts to read through.
|
|
165
|
+
* @param targets - the catalog to read.
|
|
166
|
+
* @returns the entry to patch, when this build has one for that exact version.
|
|
167
|
+
*/
|
|
168
|
+
export declare function resolveInstalledTarget(id: string, env?: CardPatchEnvironment, targets?: readonly CardPatchTarget[]): {
|
|
169
|
+
target?: CardPatchTarget;
|
|
170
|
+
view: CardPatchTargetView;
|
|
171
|
+
};
|