dsh-plugin-sessiongraph-tool 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/lib/command.d.ts +179 -0
- package/lib/command.js +398 -0
- package/lib/index.d.ts +102 -0
- package/lib/index.js +582 -0
- package/lib/invariant.d.ts +16 -0
- package/lib/invariant.js +22 -0
- package/lib/refresh.d.ts +103 -0
- package/lib/refresh.js +171 -0
- package/lib/render.d.ts +85 -0
- package/lib/render.js +247 -0
- package/lib/schema.d.ts +539 -0
- package/lib/schema.js +267 -0
- package/lib/status-hint.d.ts +42 -0
- package/lib/status-hint.js +100 -0
- package/package.json +69 -3
- package/README.md +0 -3
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model-facing `sessiongraph` tool family over `ctx.sessiongraph`. The `sessiongraph` tool is
|
|
3
|
+
* read-only, with five operations — `search`, `session`, `timeline`, `workspaces`, `status` — that
|
|
4
|
+
* answer from a pre-built index of every local conversation. A second tool, `sessiongraph_index`,
|
|
5
|
+
* builds or refreshes that index on explicit request; it is separate so it can carry its own, much
|
|
6
|
+
* larger timeout budget than a query, because `defineTool`'s `timeoutMs` is fixed per registration,
|
|
7
|
+
* not per call, and one budget cannot fit both a millisecond query and a whole-machine index run.
|
|
8
|
+
*
|
|
9
|
+
* The tools own every default the seam refuses to guess — the per-operation result limits, the cap on
|
|
10
|
+
* a snippet — so the seam's requests stay fully specified and a deployment can retune what the model
|
|
11
|
+
* reads without touching a store. They inject only `tools`, `sessiongraph`, and `systemPrompt`, and
|
|
12
|
+
* import no store: which index answers is the seam's routing decision.
|
|
13
|
+
*
|
|
14
|
+
* Namespace plugin (named exports, no default export).
|
|
15
|
+
* @module dsh-plugin-sessiongraph-tool
|
|
16
|
+
*/
|
|
17
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
18
|
+
import z from '@deepseek-ai/schemastery';
|
|
19
|
+
import type { SessiongraphRequest, SessiongraphService } from 'dsh-plugin-sessiongraph-service';
|
|
20
|
+
import type { SessiongraphToolArgs } from './schema.ts';
|
|
21
|
+
declare module '@deepseek-ai/cordis' {
|
|
22
|
+
interface Context {
|
|
23
|
+
sessiongraph: SessiongraphService;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export { SESSIONGRAPH_DEFAULT_LIMITS, SESSIONGRAPH_ENTRY_KINDS, SESSIONGRAPH_INDEX_PARAMETERS, SESSIONGRAPH_OPERATIONS, SESSIONGRAPH_OUTPUT_SCHEMA, SESSIONGRAPH_PARAMETERS, SESSIONGRAPH_TOOL_OPERATIONS, type SessiongraphIndexToolArgs, type SessiongraphQueryOperation, type SessiongraphToolArgs, type SessiongraphToolOperation, type SessiongraphToolValue, type SessiongraphValueFor, } from './schema.ts';
|
|
27
|
+
export { clipText, formatBytes, formatDuration, formatLiveReplay, formatLiveSessions, formatTime, renderSessiongraph, STALE_NOTE, } from './render.ts';
|
|
28
|
+
export type { RenderOptions } from './render.ts';
|
|
29
|
+
export { LazyIndexRefresher } from './refresh.ts';
|
|
30
|
+
export type { LazyRefreshDeps, RefreshOutcome, SynchronousIndexOptions } from './refresh.ts';
|
|
31
|
+
export { COMMAND_DEFINITION_ID, COMMAND_DESCRIPTION, COMMAND_INPUT_HINT, COMMAND_NAME, COMMAND_USAGE, INJECTED_NOTICE_PLUGIN, indexReportText, invocationWorkspace, parseCommand, registerCommands, runCommand, searchText, statusText, workspacesText, } from './command.ts';
|
|
32
|
+
export type { CommandDefinition, CommandDefinitionId, CommandInvocation, CommandOptions, CommandPlan, CommandRegistry, CommandResult, } from './command.ts';
|
|
33
|
+
export { indexStatusHint, readIndexStatus } from './status-hint.ts';
|
|
34
|
+
export type { IndexStatusFile } from './status-hint.ts';
|
|
35
|
+
/** Cordis plugin name for loader diagnostics. */
|
|
36
|
+
export declare const name = "tool-sessiongraph";
|
|
37
|
+
/** Services required by this plugin. */
|
|
38
|
+
export declare const inject: string[];
|
|
39
|
+
/** Default directory the index lives in, before `~` expansion. */
|
|
40
|
+
export declare const DEFAULT_INDEX_ROOT = "~/.dsh/sessiongraph";
|
|
41
|
+
/** Default tool-call timeout budget (ms) for the query-side `sessiongraph` tool. */
|
|
42
|
+
export declare const DEFAULT_SESSIONGRAPH_TOOL_TIMEOUT_MS = 30000;
|
|
43
|
+
/** Default timeout budget (ms) for the `sessiongraph_index` tool. Indexing every local session is a different order of work than a query. */
|
|
44
|
+
export declare const DEFAULT_SESSIONGRAPH_INDEX_TIMEOUT_MS = 300000;
|
|
45
|
+
/** Largest `limit` honored when the plugin config names none. */
|
|
46
|
+
export declare const DEFAULT_MAX_LIMIT = 100;
|
|
47
|
+
/** Default character cap for one rendered snippet or session entry. */
|
|
48
|
+
export declare const DEFAULT_MAX_SNIPPET_CHARS = 600;
|
|
49
|
+
/**
|
|
50
|
+
* Default age (ms) at which a query refreshes the index before answering. The indexer keeps a
|
|
51
|
+
* brand-new *session* cheap to find by refreshing on session creation, but the session currently
|
|
52
|
+
* being written has no successor yet; five minutes is the point where "did we just say that" would
|
|
53
|
+
* otherwise land on an index that predates the conversation.
|
|
54
|
+
*/
|
|
55
|
+
export declare const DEFAULT_FRESHNESS_THRESHOLD_MS = 300000;
|
|
56
|
+
/** The stable system-prompt guidance positioning the session index against grepping session files. */
|
|
57
|
+
export declare const SESSIONGRAPH_PROMPT_TEXT: string;
|
|
58
|
+
/** Plugin configuration: the defaults and caps the seam requires the consumer to own. */
|
|
59
|
+
export interface Config {
|
|
60
|
+
/** Directory holding the index (default `~/.dsh/sessiongraph`). `~` is expanded at load. */
|
|
61
|
+
indexRoot?: string;
|
|
62
|
+
/** Largest `limit` honored, whatever the model asks for (default 100). */
|
|
63
|
+
maxLimit?: number;
|
|
64
|
+
/** Longest snippet or session entry shown per item before it is clipped with `…` (default 600). */
|
|
65
|
+
maxSnippetChars?: number;
|
|
66
|
+
/**
|
|
67
|
+
* Age (ms) past which a query runs one incremental index before answering (default 300000). `0`
|
|
68
|
+
* disables the lazy refresh entirely: queries then trust the indexer's own schedule.
|
|
69
|
+
*/
|
|
70
|
+
freshnessThresholdMs?: number;
|
|
71
|
+
/** Tool-call timeout budget in ms for the query-side `sessiongraph` tool (default 30000). */
|
|
72
|
+
timeoutMs?: number;
|
|
73
|
+
/** Tool-call timeout budget in ms for the `sessiongraph_index` tool (default 300000). */
|
|
74
|
+
indexTimeoutMs?: number;
|
|
75
|
+
}
|
|
76
|
+
export declare const Config: z<Config>;
|
|
77
|
+
/**
|
|
78
|
+
* Register both tools and the system-prompt guidance.
|
|
79
|
+
* @param ctx - the plugin context (must inject `tools`, `sessiongraph`, `systemPrompt`).
|
|
80
|
+
* @param config - the resolved plugin configuration.
|
|
81
|
+
*/
|
|
82
|
+
export declare function apply(ctx: Context, config: Config): void;
|
|
83
|
+
/**
|
|
84
|
+
* The one-line label a pending call shows.
|
|
85
|
+
* @param args - the validated tool arguments.
|
|
86
|
+
* @returns the card title naming the operation and whichever subject the operation takes.
|
|
87
|
+
*/
|
|
88
|
+
export declare function callTitle(args: SessiongraphToolArgs): string;
|
|
89
|
+
/**
|
|
90
|
+
* Turn the model's snake_case arguments into the seam's camelCase request, applying the per-operation
|
|
91
|
+
* defaults the seam refuses to guess.
|
|
92
|
+
*
|
|
93
|
+
* Conditional requirements live here rather than in the parameter schema, because the parameter DSL
|
|
94
|
+
* has no per-operation conditionals: `search` needs `query`, `session` needs `session_id`, and a call
|
|
95
|
+
* missing either is rejected before it can reach a store.
|
|
96
|
+
* @param args - the validated tool arguments.
|
|
97
|
+
* @param indexRoot - absolute directory the index lives in.
|
|
98
|
+
* @param maxLimit - largest `limit` honored, whatever the model asked for.
|
|
99
|
+
* @returns the normalized request.
|
|
100
|
+
*/
|
|
101
|
+
export declare function buildRequest(args: SessiongraphToolArgs, indexRoot: string, maxLimit: number): SessiongraphRequest;
|
|
102
|
+
//# sourceMappingURL=index.d.ts.map
|