@spearwolf/shadow-objects 0.34.0 → 0.35.0
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 +30 -0
- package/README.md +11 -2
- package/bundle.js +4 -2
- package/package.json +9 -1
- package/src/WorkerTimeoutError.d.ts +4 -3
- package/src/WorkerTimeoutError.d.ts.map +1 -1
- package/src/WorkerTimeoutError.js.map +2 -2
- package/src/constants.d.ts +8 -4
- package/src/constants.d.ts.map +1 -1
- package/src/constants.js +6 -0
- package/src/constants.js.map +2 -2
- package/src/elements/ShaePropElement.d.ts +15 -6
- package/src/elements/ShaePropElement.d.ts.map +1 -1
- package/src/elements/ShaePropElement.js +31 -7
- package/src/elements/ShaePropElement.js.map +2 -2
- package/src/elements/ShaeWorkerElement.d.ts +10 -0
- package/src/elements/ShaeWorkerElement.d.ts.map +1 -1
- package/src/elements/ShaeWorkerElement.js +69 -2
- package/src/elements/ShaeWorkerElement.js.map +2 -2
- package/src/elements/constants.d.ts +3 -0
- package/src/elements/constants.d.ts.map +1 -1
- package/src/elements/constants.js +6 -0
- package/src/elements/constants.js.map +2 -2
- package/src/in-the-dark/Entity.d.ts +30 -0
- package/src/in-the-dark/Entity.d.ts.map +1 -1
- package/src/in-the-dark/Entity.js +38 -0
- package/src/in-the-dark/Entity.js.map +2 -2
- package/src/in-the-dark/Kernel.d.ts +24 -1
- package/src/in-the-dark/Kernel.d.ts.map +1 -1
- package/src/in-the-dark/Kernel.js +56 -1
- package/src/in-the-dark/Kernel.js.map +2 -2
- package/src/in-the-dark/Registry.d.ts +7 -1
- package/src/in-the-dark/Registry.d.ts.map +1 -1
- package/src/in-the-dark/Registry.js +29 -0
- package/src/in-the-dark/Registry.js.map +2 -2
- package/src/in-the-dark/ShadowObjectCreationScope.d.ts +8 -1
- package/src/in-the-dark/ShadowObjectCreationScope.d.ts.map +1 -1
- package/src/in-the-dark/ShadowObjectCreationScope.js +23 -16
- package/src/in-the-dark/ShadowObjectCreationScope.js.map +2 -2
- package/src/in-the-dark/SignalsPath.d.ts +2 -0
- package/src/in-the-dark/SignalsPath.d.ts.map +1 -1
- package/src/in-the-dark/SignalsPath.js +4 -0
- package/src/in-the-dark/SignalsPath.js.map +2 -2
- package/src/in-the-dark/displayName.d.ts +4 -0
- package/src/in-the-dark/displayName.d.ts.map +1 -0
- package/src/in-the-dark/displayName.js +5 -0
- package/src/in-the-dark/displayName.js.map +7 -0
- package/src/index.d.ts +2 -0
- package/src/index.d.ts.map +1 -1
- package/src/index.js +4 -0
- package/src/index.js.map +2 -2
- package/src/inspect/createKernelSnapshot.d.ts +17 -0
- package/src/inspect/createKernelSnapshot.d.ts.map +1 -0
- package/src/inspect/createKernelSnapshot.js +247 -0
- package/src/inspect/createKernelSnapshot.js.map +7 -0
- package/src/inspect/createViewSnapshot.d.ts +10 -0
- package/src/inspect/createViewSnapshot.d.ts.map +1 -0
- package/src/inspect/createViewSnapshot.js +143 -0
- package/src/inspect/createViewSnapshot.js.map +7 -0
- package/src/inspect/normalizeInspectRequest.d.ts +32 -0
- package/src/inspect/normalizeInspectRequest.d.ts.map +1 -0
- package/src/inspect/normalizeInspectRequest.js +55 -0
- package/src/inspect/normalizeInspectRequest.js.map +7 -0
- package/src/inspect/serializeValue.d.ts +13 -0
- package/src/inspect/serializeValue.d.ts.map +1 -0
- package/src/inspect/serializeValue.js +149 -0
- package/src/inspect/serializeValue.js.map +7 -0
- package/src/inspect/types.d.ts +260 -0
- package/src/inspect/types.d.ts.map +1 -0
- package/src/inspect/types.js +1 -0
- package/src/inspect/types.js.map +7 -0
- package/src/model-context/ModelContextLike.d.ts +59 -0
- package/src/model-context/ModelContextLike.d.ts.map +1 -0
- package/src/model-context/ModelContextLike.js +15 -0
- package/src/model-context/ModelContextLike.js.map +7 -0
- package/src/model-context/exposeShadowEnvsToModelContext.d.ts +48 -0
- package/src/model-context/exposeShadowEnvsToModelContext.d.ts.map +1 -0
- package/src/model-context/exposeShadowEnvsToModelContext.js +39 -0
- package/src/model-context/exposeShadowEnvsToModelContext.js.map +7 -0
- package/src/model-context/redactProps.d.ts +14 -0
- package/src/model-context/redactProps.d.ts.map +1 -0
- package/src/model-context/redactProps.js +22 -0
- package/src/model-context/redactProps.js.map +7 -0
- package/src/model-context/sharedExposure.d.ts +32 -0
- package/src/model-context/sharedExposure.d.ts.map +1 -0
- package/src/model-context/sharedExposure.js +108 -0
- package/src/model-context/sharedExposure.js.map +7 -0
- package/src/model-context/toolSupport.d.ts +72 -0
- package/src/model-context/toolSupport.d.ts.map +1 -0
- package/src/model-context/toolSupport.js +145 -0
- package/src/model-context/toolSupport.js.map +7 -0
- package/src/model-context/tools/findEntities.d.ts +15 -0
- package/src/model-context/tools/findEntities.d.ts.map +1 -0
- package/src/model-context/tools/findEntities.js +71 -0
- package/src/model-context/tools/findEntities.js.map +7 -0
- package/src/model-context/tools/getEntity.d.ts +16 -0
- package/src/model-context/tools/getEntity.d.ts.map +1 -0
- package/src/model-context/tools/getEntity.js +65 -0
- package/src/model-context/tools/getEntity.js.map +7 -0
- package/src/model-context/tools/getEntityTree.d.ts +4 -0
- package/src/model-context/tools/getEntityTree.d.ts.map +1 -0
- package/src/model-context/tools/getEntityTree.js +58 -0
- package/src/model-context/tools/getEntityTree.js.map +7 -0
- package/src/model-context/tools/getRegistry.d.ts +14 -0
- package/src/model-context/tools/getRegistry.d.ts.map +1 -0
- package/src/model-context/tools/getRegistry.js +39 -0
- package/src/model-context/tools/getRegistry.js.map +7 -0
- package/src/model-context/tools/index.d.ts +9 -0
- package/src/model-context/tools/index.d.ts.map +1 -0
- package/src/model-context/tools/index.js +16 -0
- package/src/model-context/tools/index.js.map +7 -0
- package/src/model-context/tools/listEnvs.d.ts +33 -0
- package/src/model-context/tools/listEnvs.d.ts.map +1 -0
- package/src/model-context/tools/listEnvs.js +37 -0
- package/src/model-context/tools/listEnvs.js.map +7 -0
- package/src/model-context.d.ts +13 -0
- package/src/model-context.d.ts.map +1 -0
- package/src/model-context.js +15 -0
- package/src/model-context.js.map +7 -0
- package/src/shadow-objects.d.ts +2 -0
- package/src/shadow-objects.d.ts.map +1 -1
- package/src/shadow-objects.js +4 -0
- package/src/shadow-objects.js.map +2 -2
- package/src/testing/TestEntity.d.ts +79 -0
- package/src/testing/TestEntity.d.ts.map +1 -0
- package/src/testing/TestEntity.js +135 -0
- package/src/testing/TestEntity.js.map +7 -0
- package/src/testing/createTestKernel.d.ts +11 -0
- package/src/testing/createTestKernel.d.ts.map +1 -0
- package/src/testing/createTestKernel.js +132 -0
- package/src/testing/createTestKernel.js.map +7 -0
- package/src/testing/mountShadowObject.d.ts +21 -0
- package/src/testing/mountShadowObject.d.ts.map +1 -0
- package/src/testing/mountShadowObject.js +72 -0
- package/src/testing/mountShadowObject.js.map +7 -0
- package/src/testing/recordKernelErrors.d.ts +21 -0
- package/src/testing/recordKernelErrors.d.ts.map +1 -0
- package/src/testing/recordKernelErrors.js +39 -0
- package/src/testing/recordKernelErrors.js.map +7 -0
- package/src/testing/settle.d.ts +15 -0
- package/src/testing/settle.d.ts.map +1 -0
- package/src/testing/settle.js +19 -0
- package/src/testing/settle.js.map +7 -0
- package/src/testing/types.d.ts +119 -0
- package/src/testing/types.d.ts.map +1 -0
- package/src/testing/types.js +1 -0
- package/src/testing/types.js.map +7 -0
- package/src/testing.d.ts +14 -0
- package/src/testing.d.ts.map +1 -0
- package/src/testing.js +11 -0
- package/src/testing.js.map +7 -0
- package/src/types.d.ts +150 -10
- package/src/types.d.ts.map +1 -1
- package/src/utils/attr-utils.d.ts +5 -0
- package/src/utils/attr-utils.d.ts.map +1 -1
- package/src/utils/attr-utils.js +2 -0
- package/src/utils/attr-utils.js.map +2 -2
- package/src/view/IShadowObjectEnvProxy.d.ts +9 -0
- package/src/view/IShadowObjectEnvProxy.d.ts.map +1 -1
- package/src/view/LocalShadowObjectEnv.d.ts +7 -0
- package/src/view/LocalShadowObjectEnv.d.ts.map +1 -1
- package/src/view/LocalShadowObjectEnv.js +15 -1
- package/src/view/LocalShadowObjectEnv.js.map +2 -2
- package/src/view/RemoteWorkerEnv.d.ts +22 -3
- package/src/view/RemoteWorkerEnv.d.ts.map +1 -1
- package/src/view/RemoteWorkerEnv.js +50 -1
- package/src/view/RemoteWorkerEnv.js.map +2 -2
- package/src/view/ShadowEnv.d.ts +30 -0
- package/src/view/ShadowEnv.d.ts.map +1 -1
- package/src/view/ShadowEnv.js +101 -0
- package/src/view/ShadowEnv.js.map +3 -3
- package/src/worker/MessageRouter.d.ts.map +1 -1
- package/src/worker/MessageRouter.js +23 -0
- package/src/worker/MessageRouter.js.map +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEntity.d.ts","sourceRoot":"","sources":["../../../../src/model-context/tools/getEntity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAE,cAAc,EAAE,qBAAqB,EAAC,MAAM,wBAAwB,CAAC;AACtG,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAOL,KAAK,WAAW,EAGjB,MAAM,mBAAmB,CAAC;AAE3B,wGAAwG;AACxG,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,IAAI,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;IAC9C,SAAS,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;IAC3C,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAC7B,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;CAC/B;AAED,eAAO,MAAM,mBAAmB,QAAS,WAAW,KAAG,oBA2DnD,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildRequest,
|
|
3
|
+
defineTool,
|
|
4
|
+
describeEnv,
|
|
5
|
+
inspectEnvs,
|
|
6
|
+
NamespaceInputSchema,
|
|
7
|
+
runTool,
|
|
8
|
+
ToolError,
|
|
9
|
+
textResult
|
|
10
|
+
} from "../toolSupport.js";
|
|
11
|
+
const createGetEntityTool = (ctx) => defineTool(ctx, "get-entity", {
|
|
12
|
+
title: "Get Entity",
|
|
13
|
+
description: "One Entity in full -- token, properties, Shadow Objects, Entity Contexts, its children one level down -- with the chain of ancestors above it and the View's component of the same uuid next to it, which is where a divergence between View and Kernel becomes visible. Without a namespace every environment is asked; a uuid held in more than one comes back once per environment.",
|
|
14
|
+
inputSchema: {
|
|
15
|
+
type: "object",
|
|
16
|
+
properties: {
|
|
17
|
+
uuid: { type: "string", description: "The uuid of the Entity, as the tree and the search report it." },
|
|
18
|
+
namespace: NamespaceInputSchema
|
|
19
|
+
},
|
|
20
|
+
required: ["uuid"],
|
|
21
|
+
additionalProperties: false
|
|
22
|
+
},
|
|
23
|
+
execute: runTool(async (input, signal) => {
|
|
24
|
+
const uuid = input.requiredString("uuid");
|
|
25
|
+
const envs = await inspectEnvs(
|
|
26
|
+
input.string("namespace"),
|
|
27
|
+
buildRequest(ctx.limits, { rootUuids: [uuid], maxDepth: 1 }),
|
|
28
|
+
signal,
|
|
29
|
+
ctx
|
|
30
|
+
);
|
|
31
|
+
const matches = [];
|
|
32
|
+
for (const s of envs) {
|
|
33
|
+
const node = s.kernel?.roots[0];
|
|
34
|
+
if (node === void 0) continue;
|
|
35
|
+
const { ancestors = [], ...entity } = node;
|
|
36
|
+
const entry = { namespace: s.namespace, entity, ancestors };
|
|
37
|
+
const view = s.view?.roots[0];
|
|
38
|
+
if (view !== void 0) entry.view = view;
|
|
39
|
+
if (s.kernel?.truncation !== void 0) entry.truncation = s.kernel.truncation;
|
|
40
|
+
matches.push(entry);
|
|
41
|
+
}
|
|
42
|
+
if (matches.length === 0) {
|
|
43
|
+
const failed = envs.filter((s) => s.error !== void 0).map(describeEnv);
|
|
44
|
+
throw new ToolError(
|
|
45
|
+
`no Shadow Environment holds an Entity "${uuid}"${failed.length > 0 ? ` (${failed.join("; ")})` : ""}`
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
const errors = [];
|
|
49
|
+
for (const s of envs) {
|
|
50
|
+
if (s.error !== void 0) errors.push({ namespace: s.namespace, error: s.error });
|
|
51
|
+
}
|
|
52
|
+
let summary = matches.map((m) => {
|
|
53
|
+
const where = m.ancestors.length === 0 ? "a root" : `under ${m.ancestors.map((a) => a.token).join(" > ")}`;
|
|
54
|
+
return `${m.namespace}: ${m.entity.token} "${m.entity.uuid}", ${where}, ${m.entity.childCount} children`;
|
|
55
|
+
}).join("; ");
|
|
56
|
+
if (errors.length > 0) {
|
|
57
|
+
summary += `; failed: ${errors.map((e) => `${e.namespace} (${e.error.name}: ${e.error.message})`).join(", ")}`;
|
|
58
|
+
}
|
|
59
|
+
return textResult(summary, errors.length > 0 ? { matches, errors } : { matches });
|
|
60
|
+
})
|
|
61
|
+
});
|
|
62
|
+
export {
|
|
63
|
+
createGetEntityTool
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=getEntity.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/model-context/tools/getEntity.ts"],
|
|
4
|
+
"sourcesContent": ["import type {EntityNodeSnapshot, TruncationNote, ViewComponentSnapshot} from '../../inspect/types.js';\nimport type {ModelContextToolLike} from '../ModelContextLike.js';\nimport {\n buildRequest,\n defineTool,\n describeEnv,\n inspectEnvs,\n NamespaceInputSchema,\n runTool,\n type ToolContext,\n ToolError,\n textResult,\n} from '../toolSupport.js';\n\n/** One Entity in one environment, with the chain above it and the View's component of the same uuid. */\nexport interface EntityMatchEntry {\n namespace: string;\n entity: Omit<EntityNodeSnapshot, 'ancestors'>;\n ancestors: {uuid: string; token: string}[];\n view?: ViewComponentSnapshot;\n truncation?: TruncationNote[];\n}\n\nexport const createGetEntityTool = (ctx: ToolContext): ModelContextToolLike =>\n defineTool(ctx, 'get-entity', {\n title: 'Get Entity',\n description:\n \"One Entity in full -- token, properties, Shadow Objects, Entity Contexts, its children one level down -- with the chain of ancestors above it and the View's component of the same uuid next to it, which is where a divergence between View and Kernel becomes visible. Without a namespace every environment is asked; a uuid held in more than one comes back once per environment.\",\n inputSchema: {\n type: 'object',\n properties: {\n uuid: {type: 'string', description: 'The uuid of the Entity, as the tree and the search report it.'},\n namespace: NamespaceInputSchema,\n },\n required: ['uuid'],\n additionalProperties: false,\n },\n execute: runTool(async (input, signal) => {\n const uuid = input.requiredString('uuid');\n // the depth is this tool's, not the exposure's: one level of children, and the chain above\n const envs = await inspectEnvs(\n input.string('namespace'),\n buildRequest(ctx.limits, {rootUuids: [uuid], maxDepth: 1}),\n signal,\n ctx,\n );\n\n const matches: EntityMatchEntry[] = [];\n for (const s of envs) {\n const node = s.kernel?.roots[0];\n if (node === undefined) continue;\n const {ancestors = [], ...entity} = node;\n const entry: EntityMatchEntry = {namespace: s.namespace, entity, ancestors};\n const view = s.view?.roots[0];\n if (view !== undefined) entry.view = view;\n if (s.kernel?.truncation !== undefined) entry.truncation = s.kernel.truncation;\n matches.push(entry);\n }\n\n if (matches.length === 0) {\n const failed = envs.filter((s) => s.error !== undefined).map(describeEnv);\n throw new ToolError(\n `no Shadow Environment holds an Entity \"${uuid}\"${failed.length > 0 ? ` (${failed.join('; ')})` : ''}`,\n );\n }\n\n const errors: {namespace: string; error: {name: string; message: string}}[] = [];\n for (const s of envs) {\n if (s.error !== undefined) errors.push({namespace: s.namespace, error: s.error});\n }\n\n let summary = matches\n .map((m) => {\n const where = m.ancestors.length === 0 ? 'a root' : `under ${m.ancestors.map((a) => a.token).join(' > ')}`;\n return `${m.namespace}: ${m.entity.token} \"${m.entity.uuid}\", ${where}, ${m.entity.childCount} children`;\n })\n .join('; ');\n if (errors.length > 0) {\n summary += `; failed: ${errors.map((e) => `${e.namespace} (${e.error.name}: ${e.error.message})`).join(', ')}`;\n }\n return textResult(summary, errors.length > 0 ? {matches, errors} : {matches});\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AAS,IAAI,KAAK,OAAO,KAAK,IAAI,CAAC,MAAM,EAAE;AAAA,MACtG;AAAA,IACF;AAEA,UAAM,SAAwE,CAAC;AAC/E,eAAW,KAAK,MAAM;AACpB,UAAI,EAAE,UAAU,OAAW,QAAO,KAAK,EAAC,WAAW,EAAE,WAAW,OAAO,EAAE,MAAK,CAAC;AAAA,IACjF;AAEA,QAAI,UAAU,QACX,IAAI,CAAC,MAAM;AACV,YAAM,QAAQ,EAAE,UAAU,WAAW,IAAI,WAAW,SAAS,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,CAAC;AACxG,aAAO,GAAG,EAAE,SAAS,KAAK,EAAE,OAAO,KAAK,KAAK,EAAE,OAAO,IAAI,MAAM,KAAK,KAAK,EAAE,OAAO,UAAU;AAAA,IAC/F,CAAC,EACA,KAAK,IAAI;AACZ,QAAI,OAAO,SAAS,GAAG;AACrB,iBAAW,aAAa,OAAO,IAAI,CAAC,MAAM,GAAG,EAAE,SAAS,KAAK,EAAE,MAAM,IAAI,KAAK,EAAE,MAAM,OAAO,GAAG,EAAE,KAAK,IAAI,CAAC;AAAA,IAC9G;AACA,WAAO,WAAW,SAAS,OAAO,SAAS,IAAI,EAAC,SAAS,OAAM,IAAI,EAAC,QAAO,CAAC;AAAA,EAC9E,CAAC;AACH,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEntityTree.d.ts","sourceRoot":"","sources":["../../../../src/model-context/tools/getEntityTree.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AACjE,OAAO,EASL,KAAK,WAAW,EAEjB,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,uBAAuB,QAAS,WAAW,KAAG,oBAgDvD,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildRequest,
|
|
3
|
+
defineTool,
|
|
4
|
+
describeEnv,
|
|
5
|
+
inspectEnvs,
|
|
6
|
+
NamespaceInputSchema,
|
|
7
|
+
NoEnvironments,
|
|
8
|
+
readInclude,
|
|
9
|
+
runTool,
|
|
10
|
+
textResult
|
|
11
|
+
} from "../toolSupport.js";
|
|
12
|
+
const createGetEntityTreeTool = (ctx) => defineTool(ctx, "get-entity-tree", {
|
|
13
|
+
title: "Get Entity Tree",
|
|
14
|
+
description: "The Entity Tree of one Shadow Environment, or of every one: per Entity its token, properties, Shadow Objects and Entity Contexts, next to the View's component tree of the same namespace. A cut walk carries truncation notes naming the uuids where it stopped; descend from there with rootUuid.",
|
|
15
|
+
inputSchema: {
|
|
16
|
+
type: "object",
|
|
17
|
+
properties: {
|
|
18
|
+
namespace: NamespaceInputSchema,
|
|
19
|
+
rootUuid: { type: "string", description: "Descend from this Entity instead of the roots." },
|
|
20
|
+
maxDepth: { type: "integer", minimum: 0, description: "Tree depth below each root that is walked. Default 4." },
|
|
21
|
+
maxNodes: { type: "integer", minimum: 1, description: "Total number of Entities across the walk. Default 250." },
|
|
22
|
+
include: {
|
|
23
|
+
type: "array",
|
|
24
|
+
items: { type: "string", enum: ["props", "shadowObjects", "contexts", "registry"] },
|
|
25
|
+
description: "What to carry per Entity. Default: all four."
|
|
26
|
+
},
|
|
27
|
+
valueDepth: {
|
|
28
|
+
type: "integer",
|
|
29
|
+
minimum: 0,
|
|
30
|
+
description: "How deep nested property and context values are followed. Default 3."
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
additionalProperties: false
|
|
34
|
+
},
|
|
35
|
+
execute: runTool(async (input, signal) => {
|
|
36
|
+
const own = {};
|
|
37
|
+
const rootUuid = input.string("rootUuid");
|
|
38
|
+
if (rootUuid !== void 0) own.rootUuids = [rootUuid];
|
|
39
|
+
const maxDepth = input.number("maxDepth");
|
|
40
|
+
if (maxDepth !== void 0) own.maxDepth = maxDepth;
|
|
41
|
+
const maxNodes = input.number("maxNodes");
|
|
42
|
+
if (maxNodes !== void 0) own.maxNodes = maxNodes;
|
|
43
|
+
const include = readInclude(input);
|
|
44
|
+
if (include !== void 0) own.include = include;
|
|
45
|
+
const valueDepth = input.number("valueDepth");
|
|
46
|
+
if (valueDepth !== void 0) own.values = { maxDepth: valueDepth };
|
|
47
|
+
const envs = await inspectEnvs(input.string("namespace"), buildRequest(ctx.limits, own), signal, ctx);
|
|
48
|
+
const summary = envs.map((s) => {
|
|
49
|
+
const cut = s.kernel?.truncation?.length ?? 0;
|
|
50
|
+
return cut === 0 ? describeEnv(s) : `${describeEnv(s)}, ${cut} truncation note${cut === 1 ? "" : "s"}`;
|
|
51
|
+
}).join("; ");
|
|
52
|
+
return textResult(summary || NoEnvironments, { envs });
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
export {
|
|
56
|
+
createGetEntityTreeTool
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=getEntityTree.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/model-context/tools/getEntityTree.ts"],
|
|
4
|
+
"sourcesContent": ["import type {InspectRequest} from '../../inspect/types.js';\nimport type {ModelContextToolLike} from '../ModelContextLike.js';\nimport {\n buildRequest,\n defineTool,\n describeEnv,\n inspectEnvs,\n NamespaceInputSchema,\n NoEnvironments,\n readInclude,\n runTool,\n type ToolContext,\n textResult,\n} from '../toolSupport.js';\n\nexport const createGetEntityTreeTool = (ctx: ToolContext): ModelContextToolLike =>\n defineTool(ctx, 'get-entity-tree', {\n title: 'Get Entity Tree',\n description:\n \"The Entity Tree of one Shadow Environment, or of every one: per Entity its token, properties, Shadow Objects and Entity Contexts, next to the View's component tree of the same namespace. A cut walk carries truncation notes naming the uuids where it stopped; descend from there with rootUuid.\",\n inputSchema: {\n type: 'object',\n properties: {\n namespace: NamespaceInputSchema,\n rootUuid: {type: 'string', description: 'Descend from this Entity instead of the roots.'},\n maxDepth: {type: 'integer', minimum: 0, description: 'Tree depth below each root that is walked. Default 4.'},\n maxNodes: {type: 'integer', minimum: 1, description: 'Total number of Entities across the walk. Default 250.'},\n include: {\n type: 'array',\n items: {type: 'string', enum: ['props', 'shadowObjects', 'contexts', 'registry']},\n description: 'What to carry per Entity. Default: all four.',\n },\n valueDepth: {\n type: 'integer',\n minimum: 0,\n description: 'How deep nested property and context values are followed. Default 3.',\n },\n },\n additionalProperties: false,\n },\n execute: runTool(async (input, signal) => {\n const own: InspectRequest = {};\n const rootUuid = input.string('rootUuid');\n if (rootUuid !== undefined) own.rootUuids = [rootUuid];\n const maxDepth = input.number('maxDepth');\n if (maxDepth !== undefined) own.maxDepth = maxDepth;\n const maxNodes = input.number('maxNodes');\n if (maxNodes !== undefined) own.maxNodes = maxNodes;\n const include = readInclude(input);\n if (include !== undefined) own.include = include;\n const valueDepth = input.number('valueDepth');\n if (valueDepth !== undefined) own.values = {maxDepth: valueDepth};\n\n const envs = await inspectEnvs(input.string('namespace'), buildRequest(ctx.limits, own), signal, ctx);\n\n const summary = envs\n .map((s) => {\n const cut = s.kernel?.truncation?.length ?? 0;\n return cut === 0 ? describeEnv(s) : `${describeEnv(s)}, ${cut} truncation note${cut === 1 ? '' : 's'}`;\n })\n .join('; ');\n return textResult(summary || NoEnvironments, {envs});\n }),\n });\n"],
|
|
5
|
+
"mappings": "AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AAEA,MAAM,0BAA0B,CAAC,QACtC,WAAW,KAAK,mBAAmB;AAAA,EACjC,OAAO;AAAA,EACP,aACE;AAAA,EACF,aAAa;AAAA,IACX,MAAM;AAAA,IACN,YAAY;AAAA,MACV,WAAW;AAAA,MACX,UAAU,EAAC,MAAM,UAAU,aAAa,iDAAgD;AAAA,MACxF,UAAU,EAAC,MAAM,WAAW,SAAS,GAAG,aAAa,wDAAuD;A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
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { EnvSnapshot, RegistrySnapshot } from '../../inspect/types.js';
|
|
2
|
+
import type { ModelContextToolLike } from '../ModelContextLike.js';
|
|
3
|
+
import { type ToolContext } from '../toolSupport.js';
|
|
4
|
+
export interface RegistryEntry {
|
|
5
|
+
namespace: string;
|
|
6
|
+
kind: EnvSnapshot['kind'];
|
|
7
|
+
registry?: RegistrySnapshot;
|
|
8
|
+
error?: {
|
|
9
|
+
name: string;
|
|
10
|
+
message: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export declare const createGetRegistryTool: (ctx: ToolContext) => ModelContextToolLike;
|
|
14
|
+
//# sourceMappingURL=getRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRegistry.d.ts","sourceRoot":"","sources":["../../../../src/model-context/tools/getRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAE,gBAAgB,EAAC,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAOL,KAAK,WAAW,EAEjB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,KAAK,CAAC,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAC,CAAC;CACzC;AAED,eAAO,MAAM,qBAAqB,QAAS,WAAW,KAAG,oBA+BrD,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildRequest,
|
|
3
|
+
defineTool,
|
|
4
|
+
inspectEnvs,
|
|
5
|
+
NamespaceInputSchema,
|
|
6
|
+
NoEnvironments,
|
|
7
|
+
runTool,
|
|
8
|
+
textResult
|
|
9
|
+
} from "../toolSupport.js";
|
|
10
|
+
const createGetRegistryTool = (ctx) => defineTool(ctx, "get-registry", {
|
|
11
|
+
title: "Get Registry",
|
|
12
|
+
description: "The composition rules of one Shadow Environment, or of every one: which Shadow Objects each token defines, which tokens a token routes to, and which property routes exist. The answer to why a Shadow Object is, or is not, on an Entity.",
|
|
13
|
+
inputSchema: { type: "object", properties: { namespace: NamespaceInputSchema }, additionalProperties: false },
|
|
14
|
+
execute: runTool(async (input, signal) => {
|
|
15
|
+
const envs = await inspectEnvs(
|
|
16
|
+
input.string("namespace"),
|
|
17
|
+
buildRequest(ctx.limits, { maxDepth: 0, maxNodes: 1, include: ["registry"] }),
|
|
18
|
+
signal,
|
|
19
|
+
ctx
|
|
20
|
+
);
|
|
21
|
+
const registries = envs.map((s) => {
|
|
22
|
+
const entry = { namespace: s.namespace, kind: s.kind };
|
|
23
|
+
if (s.kernel?.registry !== void 0) entry.registry = s.kernel.registry;
|
|
24
|
+
if (s.error !== void 0) entry.error = s.error;
|
|
25
|
+
return entry;
|
|
26
|
+
});
|
|
27
|
+
const summary = registries.map((r) => {
|
|
28
|
+
if (r.registry === void 0)
|
|
29
|
+
return `${r.namespace}: no registry${r.error === void 0 ? "" : ` (error: ${r.error.name}: ${r.error.message})`}`;
|
|
30
|
+
const { tokens, routes, propRoutes, isDefault } = r.registry;
|
|
31
|
+
return `${r.namespace}: ${Object.keys(tokens).length} tokens, ${Object.keys(routes).length} routes, ${Object.keys(propRoutes).length} property routes${isDefault ? ", the default registry" : ""}`;
|
|
32
|
+
}).join("; ");
|
|
33
|
+
return textResult(summary || NoEnvironments, { registries });
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
export {
|
|
37
|
+
createGetRegistryTool
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=getRegistry.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/model-context/tools/getRegistry.ts"],
|
|
4
|
+
"sourcesContent": ["import type {EnvSnapshot, RegistrySnapshot} from '../../inspect/types.js';\nimport type {ModelContextToolLike} from '../ModelContextLike.js';\nimport {\n buildRequest,\n defineTool,\n inspectEnvs,\n NamespaceInputSchema,\n NoEnvironments,\n runTool,\n type ToolContext,\n textResult,\n} from '../toolSupport.js';\n\nexport interface RegistryEntry {\n namespace: string;\n kind: EnvSnapshot['kind'];\n registry?: RegistrySnapshot;\n error?: {name: string; message: string};\n}\n\nexport const createGetRegistryTool = (ctx: ToolContext): ModelContextToolLike =>\n defineTool(ctx, 'get-registry', {\n title: 'Get Registry',\n description:\n 'The composition rules of one Shadow Environment, or of every one: which Shadow Objects each token defines, which tokens a token routes to, and which property routes exist. The answer to why a Shadow Object is, or is not, on an Entity.',\n inputSchema: {type: 'object', properties: {namespace: NamespaceInputSchema}, additionalProperties: false},\n execute: runTool(async (input, signal) => {\n const envs = await inspectEnvs(\n input.string('namespace'),\n buildRequest(ctx.limits, {maxDepth: 0, maxNodes: 1, include: ['registry']}),\n signal,\n ctx,\n );\n\n const registries = envs.map((s) => {\n const entry: RegistryEntry = {namespace: s.namespace, kind: s.kind};\n if (s.kernel?.registry !== undefined) entry.registry = s.kernel.registry;\n if (s.error !== undefined) entry.error = s.error;\n return entry;\n });\n\n const summary = registries\n .map((r) => {\n if (r.registry === undefined)\n return `${r.namespace}: no registry${r.error === undefined ? '' : ` (error: ${r.error.name}: ${r.error.message})`}`;\n const {tokens, routes, propRoutes, isDefault} = r.registry;\n return `${r.namespace}: ${Object.keys(tokens).length} tokens, ${Object.keys(routes).length} routes, ${Object.keys(propRoutes).length} property routes${isDefault ? ', the default registry' : ''}`;\n })\n .join('; ');\n return textResult(summary || NoEnvironments, {registries});\n }),\n });\n"],
|
|
5
|
+
"mappings": "AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAA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
+
import type { ModelContextToolLike } from '../ModelContextLike.js';
|
|
2
|
+
import type { ToolContext } from '../toolSupport.js';
|
|
3
|
+
export type { FindEntitiesEntry } from './findEntities.js';
|
|
4
|
+
export type { EntityMatchEntry } from './getEntity.js';
|
|
5
|
+
export type { RegistryEntry } from './getRegistry.js';
|
|
6
|
+
export type { EnvSummary } from './listEnvs.js';
|
|
7
|
+
/** The five read-only tools, in the order they are registered. */
|
|
8
|
+
export declare const createTools: (ctx: ToolContext) => ModelContextToolLike[];
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/model-context/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAOnD,YAAY,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;AACrD,YAAY,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAE9C,kEAAkE;AAClE,eAAO,MAAM,WAAW,QAAS,WAAW,KAAG,oBAAoB,EAMlE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createFindEntitiesTool } from "./findEntities.js";
|
|
2
|
+
import { createGetEntityTool } from "./getEntity.js";
|
|
3
|
+
import { createGetEntityTreeTool } from "./getEntityTree.js";
|
|
4
|
+
import { createGetRegistryTool } from "./getRegistry.js";
|
|
5
|
+
import { createListEnvsTool } from "./listEnvs.js";
|
|
6
|
+
const createTools = (ctx) => [
|
|
7
|
+
createListEnvsTool(ctx),
|
|
8
|
+
createGetEntityTreeTool(ctx),
|
|
9
|
+
createGetEntityTool(ctx),
|
|
10
|
+
createFindEntitiesTool(ctx),
|
|
11
|
+
createGetRegistryTool(ctx)
|
|
12
|
+
];
|
|
13
|
+
export {
|
|
14
|
+
createTools
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/model-context/tools/index.ts"],
|
|
4
|
+
"sourcesContent": ["import type {ModelContextToolLike} from '../ModelContextLike.js';\nimport type {ToolContext} from '../toolSupport.js';\nimport {createFindEntitiesTool} from './findEntities.js';\nimport {createGetEntityTool} from './getEntity.js';\nimport {createGetEntityTreeTool} from './getEntityTree.js';\nimport {createGetRegistryTool} from './getRegistry.js';\nimport {createListEnvsTool} from './listEnvs.js';\n\nexport type {FindEntitiesEntry} from './findEntities.js';\nexport type {EntityMatchEntry} from './getEntity.js';\nexport type {RegistryEntry} from './getRegistry.js';\nexport type {EnvSummary} from './listEnvs.js';\n\n/** The five read-only tools, in the order they are registered. */\nexport const createTools = (ctx: ToolContext): ModelContextToolLike[] => [\n createListEnvsTool(ctx),\n createGetEntityTreeTool(ctx),\n createGetEntityTool(ctx),\n createFindEntitiesTool(ctx),\n createGetRegistryTool(ctx),\n];\n"],
|
|
5
|
+
"mappings": "AAEA,SAAQ,8BAA6B;AACrC,SAAQ,2BAA0B;AAClC,SAAQ,+BAA8B;AACtC,SAAQ,6BAA4B;AACpC,SAAQ,0BAAyB;AAQ1B,MAAM,cAAc,CAAC,QAA6C;AAAA,EACvE,mBAAmB,GAAG;AAAA,EACtB,wBAAwB,GAAG;AAAA,EAC3B,oBAAoB,GAAG;AAAA,EACvB,uBAAuB,GAAG;AAAA,EAC1B,sBAAsB,GAAG;AAC3B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { EnvSnapshot } from '../../inspect/types.js';
|
|
2
|
+
import type { ModelContextToolLike } from '../ModelContextLike.js';
|
|
3
|
+
import { type ToolContext } from '../toolSupport.js';
|
|
4
|
+
/** An environment reduced to what a first call needs: identity, state, counts. No tree. */
|
|
5
|
+
export interface EnvSummary {
|
|
6
|
+
namespace: string;
|
|
7
|
+
isGlobalNamespace: boolean;
|
|
8
|
+
kind: EnvSnapshot['kind'];
|
|
9
|
+
state: EnvSnapshot['state'];
|
|
10
|
+
view?: {
|
|
11
|
+
takenAt: number;
|
|
12
|
+
counts: {
|
|
13
|
+
components: number;
|
|
14
|
+
roots: number;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
kernel?: {
|
|
18
|
+
takenAt: number;
|
|
19
|
+
thread: 'main' | 'worker';
|
|
20
|
+
counts: {
|
|
21
|
+
entities: number;
|
|
22
|
+
roots: number;
|
|
23
|
+
shadowObjects: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
error?: {
|
|
27
|
+
name: string;
|
|
28
|
+
message: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export declare const toEnvSummary: (s: EnvSnapshot) => EnvSummary;
|
|
32
|
+
export declare const createListEnvsTool: (ctx: ToolContext) => ModelContextToolLike;
|
|
33
|
+
//# sourceMappingURL=listEnvs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listEnvs.d.ts","sourceRoot":"","sources":["../../../../src/model-context/tools/listEnvs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAOL,KAAK,WAAW,EAEjB,MAAM,mBAAmB,CAAC;AAE3B,2FAA2F;AAC3F,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1B,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5B,IAAI,CAAC,EAAE;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE;YAAC,UAAU,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAC,CAAA;KAAC,CAAC;IACtE,MAAM,CAAC,EAAE;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC;QAAC,MAAM,EAAE;YAAC,QAAQ,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,aAAa,EAAE,MAAM,CAAA;SAAC,CAAA;KAAC,CAAC;IACxH,KAAK,CAAC,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAC,CAAC;CACzC;AAED,eAAO,MAAM,YAAY,MAAO,WAAW,KAAG,UAM7C,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAS,WAAW,KAAG,oBAqBlD,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildRequest,
|
|
3
|
+
defineTool,
|
|
4
|
+
describeEnv,
|
|
5
|
+
inspectEnvs,
|
|
6
|
+
NoEnvironments,
|
|
7
|
+
runTool,
|
|
8
|
+
textResult
|
|
9
|
+
} from "../toolSupport.js";
|
|
10
|
+
const toEnvSummary = (s) => {
|
|
11
|
+
const summary = { namespace: s.namespace, isGlobalNamespace: s.isGlobalNamespace, kind: s.kind, state: s.state };
|
|
12
|
+
if (s.view !== void 0) summary.view = { takenAt: s.view.takenAt, counts: s.view.counts };
|
|
13
|
+
if (s.kernel !== void 0) summary.kernel = { takenAt: s.kernel.takenAt, thread: s.kernel.thread, counts: s.kernel.counts };
|
|
14
|
+
if (s.error !== void 0) summary.error = s.error;
|
|
15
|
+
return summary;
|
|
16
|
+
};
|
|
17
|
+
const createListEnvsTool = (ctx) => defineTool(ctx, "list-envs", {
|
|
18
|
+
title: "List Shadow Environments",
|
|
19
|
+
description: "Every Shadow Environment on the page: its namespace, kind (local, worker, custom, none), state, and the counts of View components and Kernel Entities. Carries no tree. The cheapest call and the one to make first; every other tool takes a namespace from this list.",
|
|
20
|
+
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
21
|
+
execute: runTool(async (_input, signal) => {
|
|
22
|
+
const snapshots = await inspectEnvs(
|
|
23
|
+
void 0,
|
|
24
|
+
buildRequest(ctx.limits, { maxDepth: 0, maxNodes: 1, include: [] }),
|
|
25
|
+
signal,
|
|
26
|
+
ctx
|
|
27
|
+
);
|
|
28
|
+
const envs = snapshots.map(toEnvSummary);
|
|
29
|
+
const summary = envs.length === 0 ? NoEnvironments : `${envs.length} Shadow Environment${envs.length === 1 ? "" : "s"}: ${snapshots.map(describeEnv).join("; ")}`;
|
|
30
|
+
return textResult(summary, { envs });
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
export {
|
|
34
|
+
createListEnvsTool,
|
|
35
|
+
toEnvSummary
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=listEnvs.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/model-context/tools/listEnvs.ts"],
|
|
4
|
+
"sourcesContent": ["import type {EnvSnapshot} from '../../inspect/types.js';\nimport type {ModelContextToolLike} from '../ModelContextLike.js';\nimport {\n buildRequest,\n defineTool,\n describeEnv,\n inspectEnvs,\n NoEnvironments,\n runTool,\n type ToolContext,\n textResult,\n} from '../toolSupport.js';\n\n/** An environment reduced to what a first call needs: identity, state, counts. No tree. */\nexport interface EnvSummary {\n namespace: string;\n isGlobalNamespace: boolean;\n kind: EnvSnapshot['kind'];\n state: EnvSnapshot['state'];\n view?: {takenAt: number; counts: {components: number; roots: number}};\n kernel?: {takenAt: number; thread: 'main' | 'worker'; counts: {entities: number; roots: number; shadowObjects: number}};\n error?: {name: string; message: string};\n}\n\nexport const toEnvSummary = (s: EnvSnapshot): EnvSummary => {\n const summary: EnvSummary = {namespace: s.namespace, isGlobalNamespace: s.isGlobalNamespace, kind: s.kind, state: s.state};\n if (s.view !== undefined) summary.view = {takenAt: s.view.takenAt, counts: s.view.counts};\n if (s.kernel !== undefined) summary.kernel = {takenAt: s.kernel.takenAt, thread: s.kernel.thread, counts: s.kernel.counts};\n if (s.error !== undefined) summary.error = s.error;\n return summary;\n};\n\nexport const createListEnvsTool = (ctx: ToolContext): ModelContextToolLike =>\n defineTool(ctx, 'list-envs', {\n title: 'List Shadow Environments',\n description:\n 'Every Shadow Environment on the page: its namespace, kind (local, worker, custom, none), state, and the counts of View components and Kernel Entities. Carries no tree. The cheapest call and the one to make first; every other tool takes a namespace from this list.',\n inputSchema: {type: 'object', properties: {}, additionalProperties: false},\n execute: runTool(async (_input, signal) => {\n // the counts are computed over the whole kernel regardless of the walk, so the walk is cut to nothing\n const snapshots = await inspectEnvs(\n undefined,\n buildRequest(ctx.limits, {maxDepth: 0, maxNodes: 1, include: []}),\n signal,\n ctx,\n );\n const envs = snapshots.map(toEnvSummary);\n const summary =\n envs.length === 0\n ? NoEnvironments\n : `${envs.length} Shadow Environment${envs.length === 1 ? '' : 's'}: ${snapshots.map(describeEnv).join('; ')}`;\n return textResult(summary, {envs});\n }),\n });\n"],
|
|
5
|
+
"mappings": "AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AAaA,MAAM,eAAe,CAAC,MAA+B;AAC1D,QAAM,UAAsB,EAAC,WAAW,EAAE,WAAW,mBAAmB,EAAE,mBAAmB,MAAM,EAAE,MAAM,OAAO,EAAE,MAAK;AACzH,MAAI,EAAE,SAAS,OAAW,SAAQ,OAAO,EAAC,SAAS,EAAE,KAAK,SAAS,QAAQ,EAAE,KAAK,OAAM;AACxF,MAAI,EAAE,WAAW,OAAW,SAAQ,SAAS,EAAC,SAAS,EAAE,OAAO,SAAS,QAAQ,EAAE,OAAO,QAAQ,QAAQ,EAAE,OAAO,OAAM;AACzH,MAAI,EAAE,UAAU,OAAW,SAAQ,QAAQ,EAAE;AAC7C,SAAO;AACT;AAEO,MAAM,qBAAqB,CAAC,QACjC,WAAW,KAAK,aAAa;AAAA,EAC3B,OAAO;AAAA,EACP,aACE;AAAA,EACF,aAAa,EAAC,MAAM,UAAU,YAAY,CAAC,GAAG,sBAAsB,MAAK;AAAA,EACzE,SAAS,QAAQ,OAAO,QAAQ,WAAW;AAEzC,UAAM,YAAY,MAAM;AAAA,MACtB;AAAA,MACA,aAAa,IAAI,QAAQ,EAAC,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC,EAAC,CAAC;AAAA,MAChE;AAAA,MACA;AAAA,IACF;AACA,UAAM,OAAO,UAAU,IAAI,YAAY;AACvC,UAAM,UACJ,KAAK,WAAW,IACZ,iBACA,GAAG,KAAK,MAAM,sBAAsB,KAAK,WAAW,IAAI,KAAK,GAAG,KAAK,UAAU,IAAI,WAAW,EAAE,KAAK,IAAI,CAAC;AAChH,WAAO,WAAW,SAAS,EAAC,KAAI,CAAC;AAAA,EACnC,CAAC;AACH,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The model-context layer of the inspection API: one function that registers five read-only
|
|
3
|
+
* tools on `document.modelContext` (WebMCP), the structural contract it talks to the platform
|
|
4
|
+
* through, and the types of both. A subpath rather than an `index.ts` export: this module
|
|
5
|
+
* touches `document` when called, and stays out of the worker bundle and out of every consumer
|
|
6
|
+
* that does not want it. Importing it throws nowhere -- the platform is read only inside a call.
|
|
7
|
+
*/
|
|
8
|
+
export { DefaultToolPrefix, type ExposeHandle, type ExposeOptions, exposeShadowEnvsToModelContext, } from './model-context/exposeShadowEnvsToModelContext.js';
|
|
9
|
+
export { findModelContext, isModelContextLike, type ModelContextLike, type ModelContextRegisterOptions, type ModelContextToolAnnotations, type ModelContextToolLike, type ModelContextToolResult, } from './model-context/ModelContextLike.js';
|
|
10
|
+
export type { RedactRule } from './model-context/redactProps.js';
|
|
11
|
+
export type { NamespaceRule } from './model-context/toolSupport.js';
|
|
12
|
+
export type { EntityMatchEntry, EnvSummary, FindEntitiesEntry, RegistryEntry } from './model-context/tools/index.js';
|
|
13
|
+
//# sourceMappingURL=model-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-context.d.ts","sourceRoot":"","sources":["../../src/model-context.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,8BAA8B,GAC/B,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,GAC5B,MAAM,qCAAqC,CAAC;AAC7C,YAAY,EAAC,UAAU,EAAC,MAAM,gCAAgC,CAAC;AAC/D,YAAY,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAClE,YAAY,EAAC,gBAAgB,EAAE,UAAU,EAAE,iBAAiB,EAAE,aAAa,EAAC,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DefaultToolPrefix,
|
|
3
|
+
exposeShadowEnvsToModelContext
|
|
4
|
+
} from "./model-context/exposeShadowEnvsToModelContext.js";
|
|
5
|
+
import {
|
|
6
|
+
findModelContext,
|
|
7
|
+
isModelContextLike
|
|
8
|
+
} from "./model-context/ModelContextLike.js";
|
|
9
|
+
export {
|
|
10
|
+
DefaultToolPrefix,
|
|
11
|
+
exposeShadowEnvsToModelContext,
|
|
12
|
+
findModelContext,
|
|
13
|
+
isModelContextLike
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=model-context.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/model-context.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * The model-context layer of the inspection API: one function that registers five read-only\n * tools on `document.modelContext` (WebMCP), the structural contract it talks to the platform\n * through, and the types of both. A subpath rather than an `index.ts` export: this module\n * touches `document` when called, and stays out of the worker bundle and out of every consumer\n * that does not want it. Importing it throws nowhere -- the platform is read only inside a call.\n */\nexport {\n DefaultToolPrefix,\n type ExposeHandle,\n type ExposeOptions,\n exposeShadowEnvsToModelContext,\n} from './model-context/exposeShadowEnvsToModelContext.js';\nexport {\n findModelContext,\n isModelContextLike,\n type ModelContextLike,\n type ModelContextRegisterOptions,\n type ModelContextToolAnnotations,\n type ModelContextToolLike,\n type ModelContextToolResult,\n} from './model-context/ModelContextLike.js';\nexport type {RedactRule} from './model-context/redactProps.js';\nexport type {NamespaceRule} from './model-context/toolSupport.js';\nexport type {EntityMatchEntry, EnvSummary, FindEntitiesEntry, RegistryEntry} from './model-context/tools/index.js';\n"],
|
|
5
|
+
"mappings": "AAOA;AAAA,EACE;AAAA,EAGA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAMK;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/src/shadow-objects.d.ts
CHANGED
|
@@ -5,5 +5,7 @@ export * from './in-the-dark/events.js';
|
|
|
5
5
|
export * from './in-the-dark/Kernel.js';
|
|
6
6
|
export * from './in-the-dark/Registry.js';
|
|
7
7
|
export * from './in-the-dark/ShadowObject.js';
|
|
8
|
+
export { createKernelSnapshot } from './inspect/createKernelSnapshot.js';
|
|
9
|
+
export type * from './inspect/types.js';
|
|
8
10
|
export type * from './types.js';
|
|
9
11
|
//# sourceMappingURL=shadow-objects.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shadow-objects.d.ts","sourceRoot":"","sources":["../../src/shadow-objects.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,mBAAmB,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"shadow-objects.d.ts","sourceRoot":"","sources":["../../src/shadow-objects.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,OAAO,EAAC,oBAAoB,EAAC,MAAM,mCAAmC,CAAC;AACvE,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,YAAY,CAAC"}
|
package/src/shadow-objects.js
CHANGED
|
@@ -5,4 +5,8 @@ export * from "./in-the-dark/events.js";
|
|
|
5
5
|
export * from "./in-the-dark/Kernel.js";
|
|
6
6
|
export * from "./in-the-dark/Registry.js";
|
|
7
7
|
export * from "./in-the-dark/ShadowObject.js";
|
|
8
|
+
import { createKernelSnapshot } from "./inspect/createKernelSnapshot.js";
|
|
9
|
+
export {
|
|
10
|
+
createKernelSnapshot
|
|
11
|
+
};
|
|
8
12
|
//# sourceMappingURL=shadow-objects.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/shadow-objects.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './ChangeTrailRefusedError.js';\nexport * from './constants.js';\nexport * from './EntityUuidInUseError.js';\nexport * from './in-the-dark/events.js';\nexport * from './in-the-dark/Kernel.js';\nexport * from './in-the-dark/Registry.js';\nexport * from './in-the-dark/ShadowObject.js';\nexport type * from './types.js';\n"],
|
|
5
|
-
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
4
|
+
"sourcesContent": ["export * from './ChangeTrailRefusedError.js';\nexport * from './constants.js';\nexport * from './EntityUuidInUseError.js';\nexport * from './in-the-dark/events.js';\nexport * from './in-the-dark/Kernel.js';\nexport * from './in-the-dark/Registry.js';\nexport * from './in-the-dark/ShadowObject.js';\nexport {createKernelSnapshot} from './inspect/createKernelSnapshot.js';\nexport type * from './inspect/types.js';\nexport type * from './types.js';\n"],
|
|
5
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAAQ,4BAA2B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { Entity } from '../in-the-dark/Entity.js';
|
|
2
|
+
import type { Kernel } from '../in-the-dark/Kernel.js';
|
|
3
|
+
import type { ComponentPropertiesType, ShadowObjectDescription, ShadowObjectType } from '../types.js';
|
|
4
|
+
import type { AnyShadowObjectConstructor, CreateEntityOptions, ShadowObjectInstance, TestEntity, ViewMessageRecord } from './types.js';
|
|
5
|
+
/** What a `TestEntityImpl` needs from the test kernel that owns it. */
|
|
6
|
+
export interface TestKernelInternals {
|
|
7
|
+
readonly kernel: Kernel;
|
|
8
|
+
createEntity(token: string, props?: Record<string, unknown>, options?: CreateEntityOptions): TestEntity;
|
|
9
|
+
/** What the test kernel recorded for a uuid. The log is its own, so a handle never holds one. */
|
|
10
|
+
viewMessagesOf(uuid: string): readonly ViewMessageRecord[];
|
|
11
|
+
clearViewMessagesOf(uuid: string): void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Properties as a Kernel call wants them. `Object.entries()` drops symbol keys, which is right:
|
|
15
|
+
* an Entity property is string-keyed. A value of `undefined` is a removal, which is what
|
|
16
|
+
* `types.ts` says about a `ComponentPropertiesType` entry and what `removeProps()` relies on.
|
|
17
|
+
*/
|
|
18
|
+
export declare const toPropertyEntries: (props: Record<string, unknown>) => ComponentPropertiesType;
|
|
19
|
+
export declare class TestEntityImpl implements TestEntity {
|
|
20
|
+
#private;
|
|
21
|
+
readonly uuid: string;
|
|
22
|
+
constructor(testKernel: TestKernelInternals, uuid: string, token: string);
|
|
23
|
+
get entity(): Entity;
|
|
24
|
+
get token(): string;
|
|
25
|
+
/**
|
|
26
|
+
* A view onto the test kernel's own log, the way `token` and `entity` are views onto the Kernel.
|
|
27
|
+
* The handle stores nothing: a message is recorded for a uuid whether or not a handle for it
|
|
28
|
+
* existed at the time, so a handle built later answers for everything that Entity already sent.
|
|
29
|
+
*/
|
|
30
|
+
get viewMessages(): readonly ViewMessageRecord[];
|
|
31
|
+
createChild(token: string, props?: Record<string, unknown>, options?: Omit<CreateEntityOptions, 'parent'>): TestEntity;
|
|
32
|
+
/**
|
|
33
|
+
* Writes through the Kernel rather than through `Entity.setProperties()`: `changeProperties()`
|
|
34
|
+
* re-resolves the constructor set afterwards, which is how a property route -- `token@prop` in a
|
|
35
|
+
* module's `routes` -- puts a Shadow Object on an Entity or takes it off again.
|
|
36
|
+
*/
|
|
37
|
+
setProps(props: Record<string, unknown>): void;
|
|
38
|
+
/** A property set to `undefined` is a removal; see `ComponentPropertiesType` in `src/types.ts`. */
|
|
39
|
+
removeProps(...names: string[]): void;
|
|
40
|
+
readProp<T = unknown>(name: string): T | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* The effective value of an Entity Context, the one `useContext()` reads. It arrives a microtask
|
|
43
|
+
* after a provider wrote it -- `Entity` runs every context value through a `MicrotaskCollector` --
|
|
44
|
+
* so a test reads it after `settle()`.
|
|
45
|
+
*/
|
|
46
|
+
readContext<T = unknown>(name: string | symbol): T | undefined;
|
|
47
|
+
setToken(token: string): void;
|
|
48
|
+
setParent(parent: TestEntity | undefined, order?: number): void;
|
|
49
|
+
/**
|
|
50
|
+
* Delivery is synchronous, the way `Kernel.dispatchEventsToEntity()` is: a View event carries no
|
|
51
|
+
* structure, so nothing has to settle before a Shadow Object hears it.
|
|
52
|
+
*/
|
|
53
|
+
sendViewEvent(type: string, data?: unknown): void;
|
|
54
|
+
/**
|
|
55
|
+
* Emits on the Entity's own event bus. Every Shadow Object of this Entity is attached there as an
|
|
56
|
+
* eventize listener object, so a method named like the event is what receives it.
|
|
57
|
+
*/
|
|
58
|
+
emit(eventName: string | symbol, ...args: unknown[]): void;
|
|
59
|
+
shadowObjects(): ShadowObjectType[];
|
|
60
|
+
/**
|
|
61
|
+
* The one Shadow Object on this Entity that came out of `constructa`.
|
|
62
|
+
*
|
|
63
|
+
* Two rules in order, because one does not cover both constructor shapes, and because the second
|
|
64
|
+
* one is not exact. A class instance answers `instanceof` -- the `@ShadowObject` decorator wraps
|
|
65
|
+
* the class in a subclass, which still does -- and so does an object from a function constructor
|
|
66
|
+
* that returns nothing. Identity is asked first and, where anything answers it, alone.
|
|
67
|
+
*
|
|
68
|
+
* A function constructor that returns an object answers nothing: `new fn()` hands back that
|
|
69
|
+
* object, and it carries none of `fn`'s prototype. Only there does the display name decide, and
|
|
70
|
+
* only then, because a name is not an identity. `findShadowObjects()` and
|
|
71
|
+
* `describeShadowObjects()` walk the same bookkeeping in the same order, so the two lists line up
|
|
72
|
+
* index by index.
|
|
73
|
+
*/
|
|
74
|
+
shadowObjectOf<C extends AnyShadowObjectConstructor>(constructa: C): ShadowObjectInstance<C>;
|
|
75
|
+
describe(): ShadowObjectDescription[];
|
|
76
|
+
clearViewMessages(): void;
|
|
77
|
+
destroy(): void;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=TestEntity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestEntity.d.ts","sourceRoot":"","sources":["../../../src/testing/TestEntity.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,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