pilotswarm-sdk 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-loader.d.ts +9 -0
- package/dist/agent-loader.d.ts.map +1 -1
- package/dist/agent-loader.js +3 -0
- package/dist/agent-loader.js.map +1 -1
- package/dist/child-notifications.d.ts +10 -0
- package/dist/child-notifications.d.ts.map +1 -1
- package/dist/child-notifications.js +15 -1
- package/dist/child-notifications.js.map +1 -1
- package/dist/client.d.ts +2 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +14 -20
- package/dist/client.js.map +1 -1
- package/dist/cms-migrations.d.ts.map +1 -1
- package/dist/cms-migrations.js +321 -0
- package/dist/cms-migrations.js.map +1 -1
- package/dist/cms.d.ts +132 -8
- package/dist/cms.d.ts.map +1 -1
- package/dist/cms.js +142 -6
- package/dist/cms.js.map +1 -1
- package/dist/duroxide-schema-migration.d.ts +19 -0
- package/dist/duroxide-schema-migration.d.ts.map +1 -0
- package/dist/duroxide-schema-migration.js +122 -0
- package/dist/duroxide-schema-migration.js.map +1 -0
- package/dist/facts-migrations.d.ts.map +1 -1
- package/dist/facts-migrations.js +923 -0
- package/dist/facts-migrations.js.map +1 -1
- package/dist/facts-store.d.ts +278 -28
- package/dist/facts-store.d.ts.map +1 -1
- package/dist/facts-store.js +262 -32
- package/dist/facts-store.js.map +1 -1
- package/dist/facts-tools.d.ts +8 -1
- package/dist/facts-tools.d.ts.map +1 -1
- package/dist/facts-tools.js +458 -25
- package/dist/facts-tools.js.map +1 -1
- package/dist/graph-store.d.ts +243 -0
- package/dist/graph-store.d.ts.map +1 -0
- package/dist/graph-store.js +63 -0
- package/dist/graph-store.js.map +1 -0
- package/dist/graph-tools.d.ts +47 -0
- package/dist/graph-tools.d.ts.map +1 -0
- package/dist/graph-tools.js +554 -0
- package/dist/graph-tools.js.map +1 -0
- package/dist/horizon-env.d.ts +61 -0
- package/dist/horizon-env.d.ts.map +1 -0
- package/dist/horizon-env.js +120 -0
- package/dist/horizon-env.js.map +1 -0
- package/dist/index.d.ts +15 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/inspect-tools.d.ts +2 -2
- package/dist/inspect-tools.d.ts.map +1 -1
- package/dist/inspect-tools.js +303 -6
- package/dist/inspect-tools.js.map +1 -1
- package/dist/knowledge-index.d.ts +33 -2
- package/dist/knowledge-index.d.ts.map +1 -1
- package/dist/knowledge-index.js +90 -19
- package/dist/knowledge-index.js.map +1 -1
- package/dist/managed-session.d.ts.map +1 -1
- package/dist/managed-session.js +61 -2
- package/dist/managed-session.js.map +1 -1
- package/dist/management-client.d.ts +81 -3
- package/dist/management-client.d.ts.map +1 -1
- package/dist/management-client.js +97 -20
- package/dist/management-client.js.map +1 -1
- package/dist/orchestration/agents.d.ts +4 -1
- package/dist/orchestration/agents.d.ts.map +1 -1
- package/dist/orchestration/agents.js +27 -4
- package/dist/orchestration/agents.js.map +1 -1
- package/dist/orchestration/index.d.ts +2 -2
- package/dist/orchestration/index.js +1 -1
- package/dist/orchestration/lifecycle.d.ts +3 -0
- package/dist/orchestration/lifecycle.d.ts.map +1 -1
- package/dist/orchestration/lifecycle.js +6 -1
- package/dist/orchestration/lifecycle.js.map +1 -1
- package/dist/orchestration/queue.d.ts.map +1 -1
- package/dist/orchestration/queue.js +10 -1
- package/dist/orchestration/queue.js.map +1 -1
- package/dist/orchestration/runtime.d.ts +1 -1
- package/dist/orchestration/state.d.ts +1 -0
- package/dist/orchestration/state.d.ts.map +1 -1
- package/dist/orchestration/state.js +1 -0
- package/dist/orchestration/state.js.map +1 -1
- package/dist/orchestration/turn.d.ts +2 -2
- package/dist/orchestration/turn.d.ts.map +1 -1
- package/dist/orchestration/turn.js +42 -12
- package/dist/orchestration/turn.js.map +1 -1
- package/dist/orchestration-registry.d.ts.map +1 -1
- package/dist/orchestration-registry.js +4 -2
- package/dist/orchestration-registry.js.map +1 -1
- package/dist/orchestration-version.d.ts +1 -1
- package/dist/orchestration-version.js +1 -1
- package/dist/orchestration.d.ts +2 -2
- package/dist/orchestration.js +1 -1
- package/dist/orchestration_1_0_46.d.ts +1 -1
- package/dist/orchestration_1_0_47.d.ts +1 -1
- package/dist/orchestration_1_0_48.d.ts +1 -1
- package/dist/orchestration_1_0_49.d.ts +1 -1
- package/dist/orchestration_1_0_50.d.ts +1 -1
- package/dist/orchestration_1_0_52/agents.d.ts +38 -0
- package/dist/orchestration_1_0_52/agents.d.ts.map +1 -0
- package/dist/orchestration_1_0_52/agents.js +735 -0
- package/dist/orchestration_1_0_52/agents.js.map +1 -0
- package/dist/orchestration_1_0_52/index.d.ts +24 -0
- package/dist/orchestration_1_0_52/index.d.ts.map +1 -0
- package/dist/orchestration_1_0_52/index.js +13 -0
- package/dist/orchestration_1_0_52/index.js.map +1 -0
- package/dist/orchestration_1_0_52/lifecycle.d.ts +38 -0
- package/dist/orchestration_1_0_52/lifecycle.d.ts.map +1 -0
- package/dist/orchestration_1_0_52/lifecycle.js +504 -0
- package/dist/orchestration_1_0_52/lifecycle.js.map +1 -0
- package/dist/orchestration_1_0_52/queue.d.ts +7 -0
- package/dist/orchestration_1_0_52/queue.d.ts.map +1 -0
- package/dist/orchestration_1_0_52/queue.js +635 -0
- package/dist/orchestration_1_0_52/queue.js.map +1 -0
- package/dist/orchestration_1_0_52/runtime.d.ts +29 -0
- package/dist/orchestration_1_0_52/runtime.d.ts.map +1 -0
- package/dist/orchestration_1_0_52/runtime.js +190 -0
- package/dist/orchestration_1_0_52/runtime.js.map +1 -0
- package/dist/orchestration_1_0_52/state.d.ts +124 -0
- package/dist/orchestration_1_0_52/state.d.ts.map +1 -0
- package/dist/orchestration_1_0_52/state.js +104 -0
- package/dist/orchestration_1_0_52/state.js.map +1 -0
- package/dist/orchestration_1_0_52/turn.d.ts +6 -0
- package/dist/orchestration_1_0_52/turn.d.ts.map +1 -0
- package/dist/orchestration_1_0_52/turn.js +834 -0
- package/dist/orchestration_1_0_52/turn.js.map +1 -0
- package/dist/orchestration_1_0_52/utils.d.ts +22 -0
- package/dist/orchestration_1_0_52/utils.d.ts.map +1 -0
- package/dist/orchestration_1_0_52/utils.js +226 -0
- package/dist/orchestration_1_0_52/utils.js.map +1 -0
- package/dist/resourcemgr-tools.d.ts +2 -2
- package/dist/resourcemgr-tools.d.ts.map +1 -1
- package/dist/resourcemgr-tools.js +1 -1
- package/dist/resourcemgr-tools.js.map +1 -1
- package/dist/session-dumper.d.ts +2 -2
- package/dist/session-dumper.d.ts.map +1 -1
- package/dist/session-dumper.js.map +1 -1
- package/dist/session-manager.d.ts +8 -2
- package/dist/session-manager.d.ts.map +1 -1
- package/dist/session-manager.js +86 -4
- package/dist/session-manager.js.map +1 -1
- package/dist/session-messages.d.ts +2 -2
- package/dist/session-messages.d.ts.map +1 -1
- package/dist/session-messages.js +0 -6
- package/dist/session-messages.js.map +1 -1
- package/dist/session-proxy.d.ts +47 -2
- package/dist/session-proxy.d.ts.map +1 -1
- package/dist/session-proxy.js +79 -59
- package/dist/session-proxy.js.map +1 -1
- package/dist/storage-config.d.ts +62 -0
- package/dist/storage-config.d.ts.map +1 -0
- package/dist/storage-config.js +138 -0
- package/dist/storage-config.js.map +1 -0
- package/dist/storage-providers.d.ts +25 -0
- package/dist/storage-providers.d.ts.map +1 -0
- package/dist/storage-providers.js +150 -0
- package/dist/storage-providers.js.map +1 -0
- package/dist/sweeper-tools.d.ts +2 -2
- package/dist/sweeper-tools.d.ts.map +1 -1
- package/dist/system-agents.d.ts +2 -2
- package/dist/system-agents.d.ts.map +1 -1
- package/dist/types.d.ts +103 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/worker.d.ts +5 -4
- package/dist/worker.d.ts.map +1 -1
- package/dist/worker.js +108 -33
- package/dist/worker.js.map +1 -1
- package/package.json +3 -1
- package/plugins/mgmt/agents/agent-tuner.agent.md +56 -4
- package/plugins/mgmt/agents/facts-manager.agent.md +81 -3
- package/plugins/mgmt/skills/graph-debug/SKILL.md +133 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"horizon-env.d.ts","sourceRoot":"","sources":["../src/horizon-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEhE,oFAAoF;AACpF,MAAM,WAAW,gBAAgB;IAC7B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,YAAY,CAAC,EAAE,uBAAuB,CAAC;IACvC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACrC;AAuCD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAChC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GACtD,gBAAgB,CAsClB"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convenience: build the optional EnhancedFactStore + knowledge-graph worker
|
|
3
|
+
* config from the canonical `HORIZON_*` environment variables.
|
|
4
|
+
*
|
|
5
|
+
* The `PilotSwarmWorker` intentionally does NOT read `process.env` itself — app
|
|
6
|
+
* entrypoints own env parsing and pass explicit config. This helper exists so the
|
|
7
|
+
* shipped CLI/portal embedded worker, the standalone K8s worker, and the examples
|
|
8
|
+
* all map the same env vars to the same worker fields, with no drift.
|
|
9
|
+
*
|
|
10
|
+
* Returns an EMPTY object when none of the `HORIZON_*` vars are set (the default —
|
|
11
|
+
* plain `PgFactStore`, no enhanced provider, no graph). The enhanced facts store and
|
|
12
|
+
* the knowledge graph are INDEPENDENT axes: setting only `HORIZON_GRAPH_DATABASE_URL`
|
|
13
|
+
* yields a graph over the base fact store (graph tools, no search). Spread the result
|
|
14
|
+
* into the worker options:
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* const worker = new PilotSwarmWorker({
|
|
18
|
+
* store: process.env.DATABASE_URL,
|
|
19
|
+
* githubToken: process.env.GITHUB_TOKEN,
|
|
20
|
+
* ...horizonConfigFromEnv(),
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* Env vars (all optional except the database URL):
|
|
25
|
+
* HORIZON_DATABASE_URL → enhancedFactsDatabaseUrl (enables the enhanced
|
|
26
|
+
* provider; worker infers factsProvider="horizon")
|
|
27
|
+
* HORIZON_FACTS_SCHEMA → enhancedFactsSchema (default "horizon_facts")
|
|
28
|
+
* HORIZON_GRAPH_DATABASE_URL → graphDatabaseUrl (opt-in graph; unset ⇒ no graph)
|
|
29
|
+
* HORIZON_GRAPH_SCHEMA → graphSchema (default "horizon_graph")
|
|
30
|
+
* HORIZON_GRAPH_REGISTRY_SCHEMA → graphRegistrySchema (default
|
|
31
|
+
* `${graphSchema}_registry`; MUST differ from graphSchema)
|
|
32
|
+
* HORIZON_NAMESPACE_CACHE_TTL_MS → graphNamespaceCacheTtlMs (default 60000; 0 disables cache)
|
|
33
|
+
* HORIZON_EMBED_URL/MODEL/DIM → horizonEmbed (durable embedder; all three
|
|
34
|
+
* required, else the embedder is omitted and
|
|
35
|
+
* search runs lexical-only)
|
|
36
|
+
* HORIZON_EMBED_API_KEY → horizonEmbed.apiKey
|
|
37
|
+
* HORIZON_EMBED_API_KEY_HEADER→ horizonEmbed.apiKeyHeader (default "api-key")
|
|
38
|
+
* HORIZON_EMBED_BEARER → horizonEmbed.bearer (sends "Bearer <key>");
|
|
39
|
+
* inferred true when the header is "Authorization"
|
|
40
|
+
*
|
|
41
|
+
* @module
|
|
42
|
+
*/
|
|
43
|
+
const TRUE_VALUES = new Set(["1", "true", "yes", "on"]);
|
|
44
|
+
function trimmed(value) {
|
|
45
|
+
const t = value?.trim();
|
|
46
|
+
return t ? t : undefined;
|
|
47
|
+
}
|
|
48
|
+
/** Assemble the durable embedder endpoint from `HORIZON_EMBED_*`, or `undefined`. */
|
|
49
|
+
function embedFromEnv(env) {
|
|
50
|
+
const url = trimmed(env.HORIZON_EMBED_URL);
|
|
51
|
+
const model = trimmed(env.HORIZON_EMBED_MODEL);
|
|
52
|
+
const dim = Number.parseInt(env.HORIZON_EMBED_DIM ?? "", 10);
|
|
53
|
+
// The embedder needs all three of url/model/dim. Anything missing ⇒ omit it
|
|
54
|
+
// (search degrades to lexical-only) rather than crashing the worker.
|
|
55
|
+
if (!url || !model || !Number.isFinite(dim) || dim <= 0)
|
|
56
|
+
return undefined;
|
|
57
|
+
const embed = { url, model, dim };
|
|
58
|
+
const apiKey = trimmed(env.HORIZON_EMBED_API_KEY);
|
|
59
|
+
if (apiKey)
|
|
60
|
+
embed.apiKey = apiKey;
|
|
61
|
+
const apiKeyHeader = trimmed(env.HORIZON_EMBED_API_KEY_HEADER);
|
|
62
|
+
if (apiKeyHeader)
|
|
63
|
+
embed.apiKeyHeader = apiKeyHeader;
|
|
64
|
+
// `bearer` controls whether the key is sent as "Bearer <key>". Explicit env
|
|
65
|
+
// wins; otherwise infer it for an Authorization header (OpenAI-style), where
|
|
66
|
+
// the bearer prefix is required, but not for the Azure "api-key" default.
|
|
67
|
+
const bearerRaw = trimmed(env.HORIZON_EMBED_BEARER)?.toLowerCase();
|
|
68
|
+
if (bearerRaw !== undefined) {
|
|
69
|
+
embed.bearer = TRUE_VALUES.has(bearerRaw);
|
|
70
|
+
}
|
|
71
|
+
else if (apiKeyHeader && apiKeyHeader.toLowerCase() === "authorization") {
|
|
72
|
+
embed.bearer = true;
|
|
73
|
+
}
|
|
74
|
+
return embed;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Map the `HORIZON_*` environment variables to the worker's enhanced-facts /
|
|
78
|
+
* knowledge-graph config. Pure and side-effect-free; safe to call at startup.
|
|
79
|
+
*
|
|
80
|
+
* @param env - Environment source (defaults to `process.env`).
|
|
81
|
+
*/
|
|
82
|
+
export function horizonConfigFromEnv(env = process.env) {
|
|
83
|
+
const config = {};
|
|
84
|
+
// Enhanced facts store (+ schema + embedder). The embedder belongs to the
|
|
85
|
+
// enhanced store, so it is only meaningful when the facts URL is present.
|
|
86
|
+
const url = trimmed(env.HORIZON_DATABASE_URL);
|
|
87
|
+
if (url) {
|
|
88
|
+
config.enhancedFactsDatabaseUrl = url;
|
|
89
|
+
const factsSchema = trimmed(env.HORIZON_FACTS_SCHEMA);
|
|
90
|
+
if (factsSchema)
|
|
91
|
+
config.enhancedFactsSchema = factsSchema;
|
|
92
|
+
const embed = embedFromEnv(env);
|
|
93
|
+
if (embed)
|
|
94
|
+
config.horizonEmbed = embed;
|
|
95
|
+
}
|
|
96
|
+
// The knowledge graph is a SEPARATE, opt-in provider on its OWN axis — never
|
|
97
|
+
// selected implicitly, and INDEPENDENT of the enhanced facts store (07
|
|
98
|
+
// resolution order: a graph can run over a base fact store, yielding graph
|
|
99
|
+
// tools but no search tools). Wired purely from its own URL.
|
|
100
|
+
const graphUrl = trimmed(env.HORIZON_GRAPH_DATABASE_URL);
|
|
101
|
+
if (graphUrl) {
|
|
102
|
+
config.graphDatabaseUrl = graphUrl;
|
|
103
|
+
const graphSchema = trimmed(env.HORIZON_GRAPH_SCHEMA);
|
|
104
|
+
if (graphSchema)
|
|
105
|
+
config.graphSchema = graphSchema;
|
|
106
|
+
const registrySchema = trimmed(env.HORIZON_GRAPH_REGISTRY_SCHEMA);
|
|
107
|
+
if (registrySchema)
|
|
108
|
+
config.graphRegistrySchema = registrySchema;
|
|
109
|
+
const namespaceCacheTtl = trimmed(env.HORIZON_NAMESPACE_CACHE_TTL_MS);
|
|
110
|
+
if (namespaceCacheTtl !== undefined) {
|
|
111
|
+
const parsed = Number(namespaceCacheTtl);
|
|
112
|
+
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
113
|
+
throw new Error(`HORIZON_NAMESPACE_CACHE_TTL_MS must be a non-negative number, got ${JSON.stringify(namespaceCacheTtl)}`);
|
|
114
|
+
}
|
|
115
|
+
config.graphNamespaceCacheTtlMs = parsed;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return config;
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=horizon-env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"horizon-env.js","sourceRoot":"","sources":["../src/horizon-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAeH,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;AAExD,SAAS,OAAO,CAAC,KAAyB;IACtC,MAAM,CAAC,GAAG,KAAK,EAAE,IAAI,EAAE,CAAC;IACxB,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7B,CAAC;AAED,qFAAqF;AACrF,SAAS,YAAY,CAAC,GAAuC;IACzD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAC3C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IAC/C,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7D,4EAA4E;IAC5E,qEAAqE;IACrE,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IAE1E,MAAM,KAAK,GAA4B,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;IAE3D,MAAM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IAC7E,uEAAuE;IACvE,2EAA2E;IAC3E,6DAA6D;IAC7D,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;IACzD,IAAI,QAAQ,EAAE,CAAC;QACX,MAAM,CAAC,gBAAgB,GAAG,QAAQ,CAAC;QACnC,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QACtD,IAAI,WAAW;YAAE,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC;QAClD,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;QAClE,IAAI,cAAc;YAAE,MAAM,CAAC,mBAAmB,GAAG,cAAc,CAAC;QAChE,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;QACtE,IAAI,iBAAiB,KAAK,SAAS,EAAE,CAAC;YAClC,MAAM,MAAM,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;YACzC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;gBACzC,MAAM,IAAI,KAAK,CAAC,qEAAqE,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;YAC9H,CAAC;YACD,MAAM,CAAC,wBAAwB,GAAG,MAAM,CAAC;QAC7C,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -25,10 +25,20 @@ export { SessionManager } from "./session-manager.js";
|
|
|
25
25
|
export { ManagedSession } from "./managed-session.js";
|
|
26
26
|
export { SessionBlobStore, createSessionBlobStore } from "./blob-store.js";
|
|
27
27
|
export { FilesystemSessionStore, FilesystemArtifactStore } from "./session-store.js";
|
|
28
|
-
export { PgFactStore, createFactStoreForUrl } from "./facts-store.js";
|
|
29
|
-
export {
|
|
30
|
-
export type {
|
|
31
|
-
export
|
|
28
|
+
export { PgFactStore, createFactStoreForUrl, createGraphStoreForUrl, resolveFactsTarget, isEnhancedFactStore, EnhancedFactsUnsupportedError } from "./facts-store.js";
|
|
29
|
+
export { horizonConfigFromEnv } from "./horizon-env.js";
|
|
30
|
+
export type { HorizonEnvConfig } from "./horizon-env.js";
|
|
31
|
+
export { resolveStorageConfig, DEFAULT_DUROXIDE_SCHEMA, DEFAULT_RUNTIME_STORAGE_PROVIDER, DEFAULT_DUROXIDE_STORAGE_PROVIDER } from "./storage-config.js";
|
|
32
|
+
export type { StorageConfig, RuntimeStorageConfig, DuroxideStorageConfig, StorageConfigLegacyOptions } from "./storage-config.js";
|
|
33
|
+
export { runtimeStorageProviders, duroxideStorageProviders, getRuntimeStorageProvider, getDuroxideStorageProvider } from "./storage-providers.js";
|
|
34
|
+
export type { RuntimeStorageProvider, DuroxideStorageProvider } from "./storage-providers.js";
|
|
35
|
+
export { migrateLegacyDuroxideSchema } from "./duroxide-schema-migration.js";
|
|
36
|
+
export type { DuroxideSchemaMigrationOptions, DuroxideSchemaMigrationResult } from "./duroxide-schema-migration.js";
|
|
37
|
+
export { PgSessionCatalog, PgSessionCatalogProvider, computeCacheHitRatio } from "./cms.js";
|
|
38
|
+
export type { SessionCatalog, SessionCatalogProvider, SessionRow, SessionRowUpdates, SessionEvent, TopEventEmitterRow, InsertTurnMetricInput, TurnMetricRow, HourlyTokenBucketRow, SessionMetricSummary, SessionMetricSummaryUpsert, FleetStats, UserStats, UserStatsBucket, UserStatsModelBucket, UserStatsOwnerKind, SessionTreeStats, SkillKind, SkillUsageRow, SessionTreeSkillUsage, FleetSkillUsageRow, FleetSkillUsage, RetrievalSurface, RetrievalOperation, RetrievalUsageRow, SessionTreeRetrievalUsage, FleetRetrievalUsageRow, FleetRetrievalUsage, GraphNodeUsageKind, GraphNodeUsageRow, FleetGraphNodeUsageRow, FleetGraphNodeUsage, GraphEdgeSearchUsageRow, UserProfile, UserPrincipal } from "./cms.js";
|
|
39
|
+
export type { FactStore, FactRecord, StoreFactInput, StoredFactResult, ReadFactsQuery, DeleteFactInput, DeletedFactResult, DeletedFactsResult, FactsStatsRow, FactsTombstoneStats, ForcePurgeFactsInput, FactsNamespace, AccessContext, CrawledFactStamp, EnhancedFactStore, FactsCapabilities, SearchMode, SearchWeights, SearchOpts, SimilarOpts, ScoredFact, SearchResult, EmbedderStatus, EmbedderLoopStatus, EmbeddingEndpointConfig, } from "./facts-store.js";
|
|
40
|
+
export { isGraphStore, scopeKeyAccessible, DEFAULT_GRAPH_NAMESPACE } from "./graph-store.js";
|
|
41
|
+
export type { GraphStore, GraphNodeInput, GraphEdgeInput, GraphNodeQuery, GraphEdgeQuery, GraphNamespaceQuery, GraphNodeRef, GraphNodeHit, GraphEdgeRef, GraphEdgeHit, GraphEvidenceRemovalResult, SubGraph, GraphNamespaceFrontmatter, GraphNamespaceInfo, GraphNamespaceInput, GraphNamespaceListQuery, GraphNamespaceDeleteResult, } from "./graph-store.js";
|
|
32
42
|
export type { SessionStateStore, SessionMetadata, ArtifactStore, ArtifactMetadata, ArtifactDownloadResult, ArtifactUploadOptions, ArtifactEncoding, ArtifactSource, } from "./session-store.js";
|
|
33
43
|
export type { PilotSwarmClientOptions, PilotSwarmWorkerOptions, ManagedSessionConfig, PilotSwarmSessionStatus, PilotSwarmSessionInfo, SessionOwnerInfo, SessionContextUsage, SessionCompactionSnapshot, TurnAction, TurnResult, CapturedEvent, UserInputRequest, UserInputResponse, UserInputHandler, CommandMessage, CommandResponse, OrchestrationInput, SubAgentEntry, SessionPolicy, } from "./types.js";
|
|
34
44
|
export { loadSkills } from "./skills.js";
|
|
@@ -38,6 +48,7 @@ export type { Skill } from "./skills.js";
|
|
|
38
48
|
export { LOCAL_DEFAULT_USER_PRINCIPAL } from "./session-owner-utils.js";
|
|
39
49
|
export { createSweeperTools } from "./sweeper-tools.js";
|
|
40
50
|
export { createFactTools } from "./facts-tools.js";
|
|
51
|
+
export { createGraphTools } from "./graph-tools.js";
|
|
41
52
|
export { createInspectTools } from "./inspect-tools.js";
|
|
42
53
|
export { createResourceManagerTools } from "./resourcemgr-tools.js";
|
|
43
54
|
export { loadModelProviders, ModelProviderRegistry } from "./model-providers.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAClE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,YAAY,EACR,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,YAAY,EACZ,mBAAmB,EACnB,yBAAyB,EACzB,qBAAqB,EACrB,iCAAiC,EACjC,2BAA2B,EAC3B,0BAA0B,EAC1B,+BAA+B,GAClC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAClE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,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AsB,CAAC;AACpJ,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACtG,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EACH,qBAAqB,EACrB,yBAAyB,EACzB,6BAA6B,GAChC,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACR,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,wBAAwB,GAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACH,eAAe,EACf,UAAU,EACV,mBAAmB,EACnB,8BAA8B,EAC9B,8BAA8B,EAC9B,eAAe,EACf,yBAAyB,GAC5B,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACR,eAAe,EACf,yBAAyB,EACzB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACH,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,cAAc,GACjB,MAAM,cAAc,CAAC;AACtB,YAAY,EACR,cAAc,EACd,WAAW,EACX,cAAc,EACd,qBAAqB,EACrB,gBAAgB,GACnB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -23,8 +23,15 @@ export { SessionManager } from "./session-manager.js";
|
|
|
23
23
|
export { ManagedSession } from "./managed-session.js";
|
|
24
24
|
export { SessionBlobStore, createSessionBlobStore } from "./blob-store.js";
|
|
25
25
|
export { FilesystemSessionStore, FilesystemArtifactStore } from "./session-store.js";
|
|
26
|
-
export { PgFactStore, createFactStoreForUrl } from "./facts-store.js";
|
|
27
|
-
|
|
26
|
+
export { PgFactStore, createFactStoreForUrl, createGraphStoreForUrl, resolveFactsTarget, isEnhancedFactStore, EnhancedFactsUnsupportedError } from "./facts-store.js";
|
|
27
|
+
// Convenience: map HORIZON_* env vars to worker enhanced-facts/graph config.
|
|
28
|
+
export { horizonConfigFromEnv } from "./horizon-env.js";
|
|
29
|
+
export { resolveStorageConfig, DEFAULT_DUROXIDE_SCHEMA, DEFAULT_RUNTIME_STORAGE_PROVIDER, DEFAULT_DUROXIDE_STORAGE_PROVIDER } from "./storage-config.js";
|
|
30
|
+
export { runtimeStorageProviders, duroxideStorageProviders, getRuntimeStorageProvider, getDuroxideStorageProvider } from "./storage-providers.js";
|
|
31
|
+
export { migrateLegacyDuroxideSchema } from "./duroxide-schema-migration.js";
|
|
32
|
+
export { PgSessionCatalog, PgSessionCatalogProvider, computeCacheHitRatio } from "./cms.js";
|
|
33
|
+
// Graph store contract (optional, separately injected — enhancedfactstore 07 D2)
|
|
34
|
+
export { isGraphStore, scopeKeyAccessible, DEFAULT_GRAPH_NAMESPACE } from "./graph-store.js";
|
|
28
35
|
// Skills loader
|
|
29
36
|
export { loadSkills } from "./skills.js";
|
|
30
37
|
export { loadAgentFiles, systemAgentUUID, systemChildAgentUUID } from "./agent-loader.js";
|
|
@@ -35,6 +42,7 @@ export { LOCAL_DEFAULT_USER_PRINCIPAL } from "./session-owner-utils.js";
|
|
|
35
42
|
export { createSweeperTools } from "./sweeper-tools.js";
|
|
36
43
|
// Fact tools
|
|
37
44
|
export { createFactTools } from "./facts-tools.js";
|
|
45
|
+
export { createGraphTools } from "./graph-tools.js";
|
|
38
46
|
// Inspect tools (read_agent_events, etc.)
|
|
39
47
|
export { createInspectTools } from "./inspect-tools.js";
|
|
40
48
|
// Resource Manager Agent tools
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAA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AQlC,OAAO,EACH,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,cAAc,GACjB,MAAM,cAAc,CAAC;AAStB,kBAAkB;AAClB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,wDAAwD;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/inspect-tools.d.ts
CHANGED
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
* @internal
|
|
21
21
|
*/
|
|
22
22
|
import type { Tool } from "@github/copilot-sdk";
|
|
23
|
-
import type {
|
|
23
|
+
import type { SessionCatalog } from "./cms.js";
|
|
24
24
|
export interface CreateInspectToolsOptions {
|
|
25
|
-
catalog:
|
|
25
|
+
catalog: SessionCatalog;
|
|
26
26
|
agentIdentity?: string;
|
|
27
27
|
/**
|
|
28
28
|
* Optional duroxide client used by tuner-only tools that read
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspect-tools.d.ts","sourceRoot":"","sources":["../src/inspect-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"inspect-tools.d.ts","sourceRoot":"","sources":["../src/inspect-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAgB,MAAM,UAAU,CAAC;AAsF7D,MAAM,WAAW,yBAAyB;IACtC,OAAO,EAAE,cAAc,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,kBAAkB,EAAE,SAAS,CAAC;CACpD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,yBAAyB,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAugC/E"}
|
package/dist/inspect-tools.js
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
* @internal
|
|
21
21
|
*/
|
|
22
22
|
import { defineTool } from "@github/copilot-sdk";
|
|
23
|
+
import { isEnhancedFactStore } from "./facts-store.js";
|
|
23
24
|
import { formatOwnerBucketLabel, formatSessionOwnerLabel, getSessionOwnerKind, matchesOwnerBucketFilters, matchesSessionOwnerFilters } from "./session-owner-utils.js";
|
|
24
25
|
const TUNER_AGENT_ID = "agent-tuner";
|
|
25
26
|
const SYSTEM_AGENT_IDS = new Set([
|
|
@@ -97,6 +98,34 @@ export function createInspectTools(opts) {
|
|
|
97
98
|
const { catalog, agentIdentity, duroxideClient, factStore } = opts;
|
|
98
99
|
const isTuner = agentIdentity === TUNER_AGENT_ID;
|
|
99
100
|
const isSystemAgent = SYSTEM_AGENT_IDS.has(agentIdentity || "");
|
|
101
|
+
const parseSince = (toolName, sinceIso) => {
|
|
102
|
+
if (!sinceIso)
|
|
103
|
+
return undefined;
|
|
104
|
+
const d = new Date(sinceIso);
|
|
105
|
+
if (Number.isNaN(d.getTime()))
|
|
106
|
+
return { error: `${toolName}: invalid since_iso` };
|
|
107
|
+
return d;
|
|
108
|
+
};
|
|
109
|
+
const ensureSelfOrDescendant = async (toolName, targetSessionId, callerSessionId) => {
|
|
110
|
+
if (isTuner)
|
|
111
|
+
return null;
|
|
112
|
+
if (!callerSessionId)
|
|
113
|
+
return { error: `${toolName}: caller session id is required` };
|
|
114
|
+
if (targetSessionId === callerSessionId)
|
|
115
|
+
return null;
|
|
116
|
+
try {
|
|
117
|
+
const descendants = await catalog.getDescendantSessionIds(callerSessionId);
|
|
118
|
+
if (descendants.includes(targetSessionId))
|
|
119
|
+
return null;
|
|
120
|
+
return {
|
|
121
|
+
error: `${toolName}: session_id ${targetSessionId.slice(0, 8)} is not your session or a descendant. ` +
|
|
122
|
+
`You may only inspect yourself or sessions in your spawn tree.`,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
catch (err) {
|
|
126
|
+
return { error: `${toolName}: descendant lookup failed: ${err?.message || String(err)}` };
|
|
127
|
+
}
|
|
128
|
+
};
|
|
100
129
|
const readAgentEventsTool = defineTool("read_agent_events", {
|
|
101
130
|
description: "Read durable events from a descendant agent in your spawn tree, paginated by seq cursor. " +
|
|
102
131
|
"Use cursor=null (or omit) for the most recent page; pass the returned prevCursor to walk backwards in time. " +
|
|
@@ -400,13 +429,7 @@ export function createInspectTools(opts) {
|
|
|
400
429
|
}
|
|
401
430
|
},
|
|
402
431
|
});
|
|
403
|
-
if (!isSystemAgent) {
|
|
404
|
-
return [readAgentEventsTool];
|
|
405
|
-
}
|
|
406
432
|
const systemReadTools = [listAllSessionsTool, readSessionInfoTool, readUserStatsTool];
|
|
407
|
-
if (!isTuner) {
|
|
408
|
-
return [readAgentEventsTool, ...systemReadTools];
|
|
409
|
-
}
|
|
410
433
|
// ─── Tuner-only read tools ─────────────────────────────────────────────
|
|
411
434
|
// Bypass the lineage gate; expose CMS state, metric summaries, and
|
|
412
435
|
// (when a duroxide client is provided) orchestration stats and history.
|
|
@@ -431,6 +454,45 @@ export function createInspectTools(opts) {
|
|
|
431
454
|
}
|
|
432
455
|
},
|
|
433
456
|
});
|
|
457
|
+
const readSessionGraphSearchesTool = defineTool("read_session_graph_searches", {
|
|
458
|
+
description: "Graph-search forensics: the `graph.searched` events a session emitted — what graph queries it ran " +
|
|
459
|
+
"(search_nodes / search_edges / neighbourhood, with the query args) and how many results each returned. " +
|
|
460
|
+
"Use to answer 'what did session X search the graph for, and what did it get back?'",
|
|
461
|
+
parameters: {
|
|
462
|
+
type: "object",
|
|
463
|
+
properties: {
|
|
464
|
+
session_id: { type: "string" },
|
|
465
|
+
limit: { type: "number", description: "Max session events to scan (default 500)." },
|
|
466
|
+
},
|
|
467
|
+
required: ["session_id"],
|
|
468
|
+
},
|
|
469
|
+
handler: async (args) => {
|
|
470
|
+
const id = normalizeSessionId(args.session_id);
|
|
471
|
+
try {
|
|
472
|
+
const events = await catalog.getSessionEvents(id, undefined, args.limit ?? 500);
|
|
473
|
+
const searches = events
|
|
474
|
+
.filter((e) => e.eventType === "graph.searched")
|
|
475
|
+
.map((e) => {
|
|
476
|
+
const d = e.data ?? {};
|
|
477
|
+
return {
|
|
478
|
+
seq: e.seq,
|
|
479
|
+
at: eventTimestamp(e),
|
|
480
|
+
operation: d.operation ?? d.kind ?? "",
|
|
481
|
+
namespace: d.namespace ?? null,
|
|
482
|
+
nodeKind: d.operation === "graph_search_nodes" ? d.kind ?? null : null,
|
|
483
|
+
queryPreview: d.queryPreview ?? d.nameLikePreview ?? null,
|
|
484
|
+
resultCount: d.resultCount ?? 0,
|
|
485
|
+
nodeCount: d.nodeCount ?? null,
|
|
486
|
+
edgeCount: d.edgeCount ?? null,
|
|
487
|
+
};
|
|
488
|
+
});
|
|
489
|
+
return { sessionId: id, count: searches.length, searches };
|
|
490
|
+
}
|
|
491
|
+
catch (err) {
|
|
492
|
+
return { error: `read_session_graph_searches: ${err?.message || String(err)}` };
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
});
|
|
434
496
|
const readSessionTreeStatsTool = defineTool("read_session_tree_stats", {
|
|
435
497
|
description: "Read rolled-up stats across the spawn tree rooted at the given session: " +
|
|
436
498
|
"tokens, snapshot bytes, dehydrations, hydrations, per-descendant breakdown.",
|
|
@@ -571,6 +633,190 @@ export function createInspectTools(opts) {
|
|
|
571
633
|
}
|
|
572
634
|
},
|
|
573
635
|
});
|
|
636
|
+
const readSessionRetrievalUsageTool = defineTool("read_session_retrieval_usage", {
|
|
637
|
+
description: "Read per-session retrieval usage for facts_search, facts_similar, search_skills, and graph reads. " +
|
|
638
|
+
"Returns count-only aggregates from session_events; no returned facts/nodes/edges are stored.",
|
|
639
|
+
parameters: {
|
|
640
|
+
type: "object",
|
|
641
|
+
properties: {
|
|
642
|
+
session_id: { type: "string" },
|
|
643
|
+
since_iso: { type: "string", description: "Optional ISO timestamp lower bound." },
|
|
644
|
+
},
|
|
645
|
+
required: ["session_id"],
|
|
646
|
+
},
|
|
647
|
+
handler: async (args, ctx) => {
|
|
648
|
+
const id = normalizeSessionId(args.session_id);
|
|
649
|
+
try {
|
|
650
|
+
const denied = await ensureSelfOrDescendant("read_session_retrieval_usage", id, ctx?.sessionId);
|
|
651
|
+
if (denied)
|
|
652
|
+
return denied;
|
|
653
|
+
const since = parseSince("read_session_retrieval_usage", args.since_iso);
|
|
654
|
+
if (since && "error" in since)
|
|
655
|
+
return since;
|
|
656
|
+
const rows = await catalog.getSessionRetrievalUsage(id, since ? { since } : undefined);
|
|
657
|
+
return { enabled: true, sessionId: id, rows, totalCalls: rows.reduce((a, r) => a + r.calls, 0) };
|
|
658
|
+
}
|
|
659
|
+
catch (err) {
|
|
660
|
+
return { error: `read_session_retrieval_usage: ${err?.message || String(err)}` };
|
|
661
|
+
}
|
|
662
|
+
},
|
|
663
|
+
});
|
|
664
|
+
const readSessionTreeRetrievalUsageTool = defineTool("read_session_tree_retrieval_usage", {
|
|
665
|
+
description: "Read retrieval usage rolled up across a session spawn tree. Parents can use this to understand " +
|
|
666
|
+
"their children facts/graph consumption; tuner can read any tree.",
|
|
667
|
+
parameters: {
|
|
668
|
+
type: "object",
|
|
669
|
+
properties: {
|
|
670
|
+
session_id: { type: "string" },
|
|
671
|
+
since_iso: { type: "string", description: "Optional ISO timestamp lower bound." },
|
|
672
|
+
},
|
|
673
|
+
required: ["session_id"],
|
|
674
|
+
},
|
|
675
|
+
handler: async (args, ctx) => {
|
|
676
|
+
const id = normalizeSessionId(args.session_id);
|
|
677
|
+
try {
|
|
678
|
+
const denied = await ensureSelfOrDescendant("read_session_tree_retrieval_usage", id, ctx?.sessionId);
|
|
679
|
+
if (denied)
|
|
680
|
+
return denied;
|
|
681
|
+
const since = parseSince("read_session_tree_retrieval_usage", args.since_iso);
|
|
682
|
+
if (since && "error" in since)
|
|
683
|
+
return since;
|
|
684
|
+
return await catalog.getSessionTreeRetrievalUsage(id, since ? { since } : undefined);
|
|
685
|
+
}
|
|
686
|
+
catch (err) {
|
|
687
|
+
return { error: `read_session_tree_retrieval_usage: ${err?.message || String(err)}` };
|
|
688
|
+
}
|
|
689
|
+
},
|
|
690
|
+
});
|
|
691
|
+
const readFleetRetrievalUsageTool = defineTool("read_fleet_retrieval_usage", {
|
|
692
|
+
description: "Read fleet-wide count-only retrieval usage broken down by agent, surface, operation, and namespace. " +
|
|
693
|
+
"Always pass since_iso for the default UI/tuner window to keep the scan bounded.",
|
|
694
|
+
parameters: {
|
|
695
|
+
type: "object",
|
|
696
|
+
properties: {
|
|
697
|
+
include_deleted: { type: "boolean", description: "Default false." },
|
|
698
|
+
since_iso: { type: "string", description: "Optional ISO timestamp lower bound on event time." },
|
|
699
|
+
},
|
|
700
|
+
},
|
|
701
|
+
handler: async (args) => {
|
|
702
|
+
try {
|
|
703
|
+
const since = parseSince("read_fleet_retrieval_usage", args.since_iso);
|
|
704
|
+
if (since && "error" in since)
|
|
705
|
+
return since;
|
|
706
|
+
return await catalog.getFleetRetrievalUsage({ since: since, includeDeleted: args.include_deleted === true });
|
|
707
|
+
}
|
|
708
|
+
catch (err) {
|
|
709
|
+
return { error: `read_fleet_retrieval_usage: ${err?.message || String(err)}` };
|
|
710
|
+
}
|
|
711
|
+
},
|
|
712
|
+
});
|
|
713
|
+
const readSessionGraphNodeUsageTool = defineTool("read_session_graph_node_usage", {
|
|
714
|
+
description: "Read exact graph node-key usage for a session: node keys searched as exact seeds and node keys loaded " +
|
|
715
|
+
"as neighbourhood anchors. Supports node_key_like and kind searched|loaded.",
|
|
716
|
+
parameters: {
|
|
717
|
+
type: "object",
|
|
718
|
+
properties: {
|
|
719
|
+
session_id: { type: "string" },
|
|
720
|
+
since_iso: { type: "string", description: "Optional ISO timestamp lower bound." },
|
|
721
|
+
limit: { type: "number", description: "Max rows (default 100, max 500)." },
|
|
722
|
+
node_key_like: { type: "string", description: "Optional substring match over nodeKey." },
|
|
723
|
+
kind: { type: "string", enum: ["searched", "loaded"], description: "Optional row kind filter." },
|
|
724
|
+
},
|
|
725
|
+
required: ["session_id"],
|
|
726
|
+
},
|
|
727
|
+
handler: async (args, ctx) => {
|
|
728
|
+
const id = normalizeSessionId(args.session_id);
|
|
729
|
+
try {
|
|
730
|
+
const denied = await ensureSelfOrDescendant("read_session_graph_node_usage", id, ctx?.sessionId);
|
|
731
|
+
if (denied)
|
|
732
|
+
return denied;
|
|
733
|
+
const since = parseSince("read_session_graph_node_usage", args.since_iso);
|
|
734
|
+
if (since && "error" in since)
|
|
735
|
+
return since;
|
|
736
|
+
const rows = await catalog.getSessionGraphNodeUsage(id, {
|
|
737
|
+
since: since,
|
|
738
|
+
limit: args.limit,
|
|
739
|
+
nodeKeyLike: args.node_key_like,
|
|
740
|
+
kind: args.kind,
|
|
741
|
+
});
|
|
742
|
+
return { enabled: true, sessionId: id, rows };
|
|
743
|
+
}
|
|
744
|
+
catch (err) {
|
|
745
|
+
return { error: `read_session_graph_node_usage: ${err?.message || String(err)}` };
|
|
746
|
+
}
|
|
747
|
+
},
|
|
748
|
+
});
|
|
749
|
+
const readFleetGraphNodeUsageTool = defineTool("read_fleet_graph_node_usage", {
|
|
750
|
+
description: "Read fleet-wide exact graph node-key usage. Use since_iso plus optional node_key_like/kind to answer " +
|
|
751
|
+
"how often a node key was searched or loaded over a bounded window.",
|
|
752
|
+
parameters: {
|
|
753
|
+
type: "object",
|
|
754
|
+
properties: {
|
|
755
|
+
include_deleted: { type: "boolean", description: "Default false." },
|
|
756
|
+
since_iso: { type: "string", description: "Optional ISO timestamp lower bound on event time." },
|
|
757
|
+
limit: { type: "number", description: "Max rows (default 100, max 500)." },
|
|
758
|
+
node_key_like: { type: "string", description: "Optional substring match over nodeKey." },
|
|
759
|
+
kind: { type: "string", enum: ["searched", "loaded"], description: "Optional row kind filter." },
|
|
760
|
+
},
|
|
761
|
+
},
|
|
762
|
+
handler: async (args) => {
|
|
763
|
+
try {
|
|
764
|
+
const since = parseSince("read_fleet_graph_node_usage", args.since_iso);
|
|
765
|
+
if (since && "error" in since)
|
|
766
|
+
return since;
|
|
767
|
+
return await catalog.getFleetGraphNodeUsage({
|
|
768
|
+
since: since,
|
|
769
|
+
includeDeleted: args.include_deleted === true,
|
|
770
|
+
limit: args.limit,
|
|
771
|
+
nodeKeyLike: args.node_key_like,
|
|
772
|
+
kind: args.kind,
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
catch (err) {
|
|
776
|
+
return { error: `read_fleet_graph_node_usage: ${err?.message || String(err)}` };
|
|
777
|
+
}
|
|
778
|
+
},
|
|
779
|
+
});
|
|
780
|
+
const readSessionGraphEdgeSearchUsageTool = defineTool("read_session_graph_edge_search_usage", {
|
|
781
|
+
description: "Read requested graph edge-search shapes for a session, grouped by predicateKey/fromKey/toKey/namespace.",
|
|
782
|
+
parameters: {
|
|
783
|
+
type: "object",
|
|
784
|
+
properties: {
|
|
785
|
+
session_id: { type: "string" },
|
|
786
|
+
since_iso: { type: "string", description: "Optional ISO timestamp lower bound." },
|
|
787
|
+
limit: { type: "number", description: "Max rows (default 100, max 500)." },
|
|
788
|
+
},
|
|
789
|
+
required: ["session_id"],
|
|
790
|
+
},
|
|
791
|
+
handler: async (args, ctx) => {
|
|
792
|
+
const id = normalizeSessionId(args.session_id);
|
|
793
|
+
try {
|
|
794
|
+
const denied = await ensureSelfOrDescendant("read_session_graph_edge_search_usage", id, ctx?.sessionId);
|
|
795
|
+
if (denied)
|
|
796
|
+
return denied;
|
|
797
|
+
const since = parseSince("read_session_graph_edge_search_usage", args.since_iso);
|
|
798
|
+
if (since && "error" in since)
|
|
799
|
+
return since;
|
|
800
|
+
const rows = await catalog.getSessionGraphEdgeSearchUsage(id, { since: since, limit: args.limit });
|
|
801
|
+
return { enabled: true, sessionId: id, rows };
|
|
802
|
+
}
|
|
803
|
+
catch (err) {
|
|
804
|
+
return { error: `read_session_graph_edge_search_usage: ${err?.message || String(err)}` };
|
|
805
|
+
}
|
|
806
|
+
},
|
|
807
|
+
});
|
|
808
|
+
const lineageRetrievalTools = [
|
|
809
|
+
readSessionRetrievalUsageTool,
|
|
810
|
+
readSessionTreeRetrievalUsageTool,
|
|
811
|
+
readSessionGraphNodeUsageTool,
|
|
812
|
+
readSessionGraphEdgeSearchUsageTool,
|
|
813
|
+
];
|
|
814
|
+
if (!isSystemAgent) {
|
|
815
|
+
return [readAgentEventsTool, ...lineageRetrievalTools];
|
|
816
|
+
}
|
|
817
|
+
if (!isTuner) {
|
|
818
|
+
return [readAgentEventsTool, ...systemReadTools, ...lineageRetrievalTools];
|
|
819
|
+
}
|
|
574
820
|
const factsTools = [];
|
|
575
821
|
if (factStore) {
|
|
576
822
|
factsTools.push(defineTool("read_session_facts_stats", {
|
|
@@ -646,16 +892,67 @@ export function createInspectTools(opts) {
|
|
|
646
892
|
}
|
|
647
893
|
},
|
|
648
894
|
}));
|
|
895
|
+
factsTools.push(defineTool("read_facts_tombstone_stats", {
|
|
896
|
+
description: "Read soft-deleted fact tombstone backlog stats. Use to diagnose graph crawler lag: " +
|
|
897
|
+
"unreconciled tombstones still have last_crawled_at NULL and may strand graph evidence if TTL-purged.",
|
|
898
|
+
parameters: {
|
|
899
|
+
type: "object",
|
|
900
|
+
properties: {
|
|
901
|
+
ttl_seconds: { type: "number", description: "Tombstone TTL in seconds. Default 21600 (6h)." },
|
|
902
|
+
},
|
|
903
|
+
},
|
|
904
|
+
handler: async (args) => {
|
|
905
|
+
try {
|
|
906
|
+
return await factStore.getFactsTombstoneStats(args.ttl_seconds);
|
|
907
|
+
}
|
|
908
|
+
catch (err) {
|
|
909
|
+
return { error: `read_facts_tombstone_stats: ${err?.message || String(err)}` };
|
|
910
|
+
}
|
|
911
|
+
},
|
|
912
|
+
}));
|
|
913
|
+
// Durable embedder status (07 P5) — semantic/hybrid search only returns
|
|
914
|
+
// semantic hits while the in-DB embed loop is running. Base PgFactStore
|
|
915
|
+
// (or an enhanced store with no embedding endpoint) reports unsupported.
|
|
916
|
+
factsTools.push(defineTool("read_embedder_status", {
|
|
917
|
+
description: "Read the durable embedder status for the facts store: whether the in-database batch-embedding " +
|
|
918
|
+
"loop is running. Semantic and hybrid facts_search only return semantic hits while it runs; if it " +
|
|
919
|
+
"is stopped or unsupported, search is lexical-only. Use when diagnosing why semantic search returns nothing.",
|
|
920
|
+
parameters: { type: "object", properties: {} },
|
|
921
|
+
handler: async () => {
|
|
922
|
+
try {
|
|
923
|
+
// Gate ONLY on EnhancedFactStore (guarantees embedderStatus()).
|
|
924
|
+
// NOT on construction-time capabilities.embedder — the durable
|
|
925
|
+
// loop may be running for the schema even if THIS store was
|
|
926
|
+
// built without an embedding endpoint. embedderStatus() reads
|
|
927
|
+
// durable df.instances state (the truth).
|
|
928
|
+
if (!isEnhancedFactStore(factStore)) {
|
|
929
|
+
return { supported: false, note: "facts store has no durable embedder (lexical-only search)." };
|
|
930
|
+
}
|
|
931
|
+
const st = await factStore.embedderStatus();
|
|
932
|
+
return { supported: true, running: st.running, instanceId: st.instanceId, status: st.status };
|
|
933
|
+
}
|
|
934
|
+
catch (err) {
|
|
935
|
+
return { error: `read_embedder_status: ${err?.message || String(err)}` };
|
|
936
|
+
}
|
|
937
|
+
},
|
|
938
|
+
}));
|
|
649
939
|
}
|
|
650
940
|
const tools = [
|
|
651
941
|
readAgentEventsTool,
|
|
652
942
|
...systemReadTools,
|
|
653
943
|
readSessionMetricSummaryTool,
|
|
944
|
+
readSessionGraphSearchesTool,
|
|
654
945
|
readSessionTreeStatsTool,
|
|
655
946
|
readFleetStatsTool,
|
|
656
947
|
readSessionSkillUsageTool,
|
|
657
948
|
readSessionTreeSkillUsageTool,
|
|
658
949
|
readFleetSkillUsageTool,
|
|
950
|
+
readSessionRetrievalUsageTool,
|
|
951
|
+
readSessionTreeRetrievalUsageTool,
|
|
952
|
+
readFleetRetrievalUsageTool,
|
|
953
|
+
readSessionGraphNodeUsageTool,
|
|
954
|
+
readFleetGraphNodeUsageTool,
|
|
955
|
+
readSessionGraphEdgeSearchUsageTool,
|
|
659
956
|
...factsTools,
|
|
660
957
|
];
|
|
661
958
|
if (duroxideClient) {
|