dsh-context 0.62.2 → 0.62.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +3 -3
- package/lib/index.js +27 -10
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -11404,7 +11404,7 @@ window.__ModuleLoader__.load({
|
|
|
11404
11404
|
return function PluginInfo() {
|
|
11405
11405
|
const [latest, setLatest] = (0, react.useState)(null);
|
|
11406
11406
|
(0, react.useEffect)(() => {
|
|
11407
|
-
if ("0.62.
|
|
11407
|
+
if ("0.62.3".includes("-dev")) return;
|
|
11408
11408
|
let on = true;
|
|
11409
11409
|
fetchLatestVersion().then((v) => {
|
|
11410
11410
|
if (on && v) setLatest(v);
|
|
@@ -11413,8 +11413,8 @@ window.__ModuleLoader__.load({
|
|
|
11413
11413
|
on = false;
|
|
11414
11414
|
};
|
|
11415
11415
|
}, []);
|
|
11416
|
-
const update = latest !== null && isNewerVersion(latest, "0.62.
|
|
11417
|
-
const nameText = "dsh-context (v0.62.
|
|
11416
|
+
const update = latest !== null && isNewerVersion(latest, "0.62.3") ? latest : null;
|
|
11417
|
+
const nameText = "dsh-context (v0.62.3)";
|
|
11418
11418
|
const nameValue = [nameText];
|
|
11419
11419
|
if (update) nameValue.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11420
11420
|
className: "lc-pi-update",
|
package/lib/index.js
CHANGED
|
@@ -2155,12 +2155,15 @@ const FIRST_PARTY_SOURCES = Object.freeze({
|
|
|
2155
2155
|
* first argument, so `reader.fiber.name` identifies the plugin that is about
|
|
2156
2156
|
* to call `register()`.
|
|
2157
2157
|
*
|
|
2158
|
-
* - The `internal/get` handler records
|
|
2159
|
-
*
|
|
2160
|
-
*
|
|
2161
|
-
*
|
|
2162
|
-
*
|
|
2163
|
-
*
|
|
2158
|
+
* - The `internal/get` handler records the reading fiber's NAME — a scalar,
|
|
2159
|
+
* never the reader context, which would pin the caller's whole agent — and
|
|
2160
|
+
* wraps the tools service's `register` (once per underlying instance —
|
|
2161
|
+
* cordis hands out a fresh traced proxy per read of a tracked service, so
|
|
2162
|
+
* the proxy is peeled to the stable instance first; an earlier wrapper of a
|
|
2163
|
+
* previous hook incarnation is peeled back to the original, so a plugin
|
|
2164
|
+
* reload re-wraps without stacking) to capture the reader at registration
|
|
2165
|
+
* time into a live map. Every wrapper is undone when the plugin unloads:
|
|
2166
|
+
* the original `register` goes back on the instance, unless a newer hook
|
|
2164
2167
|
* incarnation re-wrapped it first (that incarnation's own cleanup then
|
|
2165
2168
|
* owns the restore).
|
|
2166
2169
|
* - When the reader slot is missing, root-named, or this plugin's own (e.g.
|
|
@@ -2221,6 +2224,20 @@ function packageNameFrom(file) {
|
|
|
2221
2224
|
}
|
|
2222
2225
|
}
|
|
2223
2226
|
const FRAME_POSITION = /:\d+:\d+$/;
|
|
2227
|
+
/** Symbol cordis registers (`Symbol.for`) on its traced proxies: reading it
|
|
2228
|
+
* yields the wrapped target — the stable underlying service instance. */
|
|
2229
|
+
const CORDIS_ORIGINAL = Symbol.for("cordis.original");
|
|
2230
|
+
/**
|
|
2231
|
+
* Peel cordis's per-read traced proxy of a tracked service (dsh's ToolRuntime
|
|
2232
|
+
* is one — every `ctx.tools` read returns a fresh proxy closing over the
|
|
2233
|
+
* reader's context) down to the instance it wraps, so identity-keyed
|
|
2234
|
+
* bookkeeping sees one stable object. Plain service objects pass through
|
|
2235
|
+
* unchanged.
|
|
2236
|
+
* @param tools - the value as handed out by a context read.
|
|
2237
|
+
*/
|
|
2238
|
+
function rawInstanceOf(tools) {
|
|
2239
|
+
return tools?.[CORDIS_ORIGINAL] ?? tools;
|
|
2240
|
+
}
|
|
2224
2241
|
/** Package name of this module's own package (self-fallbacks are filtered). */
|
|
2225
2242
|
const selfPackage = packageNameFrom(selfUrl);
|
|
2226
2243
|
/**
|
|
@@ -2279,7 +2296,7 @@ function createToolAttribution(ctx) {
|
|
|
2279
2296
|
const instance = tools;
|
|
2280
2297
|
const wrappedRegister = function(definition) {
|
|
2281
2298
|
const toolName = definition?.name;
|
|
2282
|
-
let owner = lastReader
|
|
2299
|
+
let owner = lastReader;
|
|
2283
2300
|
if (!owner || owner === "root" || owner === self) owner = callerPackageFrom((/* @__PURE__ */ new Error()).stack);
|
|
2284
2301
|
const dispose = original.call(this, definition);
|
|
2285
2302
|
if (typeof toolName === "string" && owner && owner !== "root" && owner !== self && owner !== selfPackage) {
|
|
@@ -2303,14 +2320,14 @@ function createToolAttribution(ctx) {
|
|
|
2303
2320
|
ctx.on("internal/get", (reader, name, _error, next) => {
|
|
2304
2321
|
if (name !== "tools") return next();
|
|
2305
2322
|
const tools = next();
|
|
2306
|
-
lastReader = reader;
|
|
2307
|
-
wrapInstance(tools);
|
|
2323
|
+
lastReader = reader.fiber.name;
|
|
2324
|
+
wrapInstance(rawInstanceOf(tools));
|
|
2308
2325
|
return tools;
|
|
2309
2326
|
});
|
|
2310
2327
|
ctx.effect(() => () => {
|
|
2311
2328
|
for (const restore of patched.splice(0)) restore();
|
|
2312
2329
|
}, "tools.register attribution");
|
|
2313
|
-
const toolsService = ctx.get("tools", false);
|
|
2330
|
+
const toolsService = rawInstanceOf(ctx.get("tools", false));
|
|
2314
2331
|
wrapInstance(toolsService);
|
|
2315
2332
|
const boot = /* @__PURE__ */ new Set();
|
|
2316
2333
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-context",
|
|
3
|
-
"version": "0.62.
|
|
3
|
+
"version": "0.62.3",
|
|
4
4
|
"description": "A DeepSeek Harness plugin for context insight and management, with context dashboard and context command, for understanding how the context is made of, and how it evolves.",
|
|
5
5
|
"icon": "icon.svg",
|
|
6
6
|
"author": "bowenliang123",
|