@deepseek-ai/dsh-tool-session-query 0.0.1-rc.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 +28 -0
- package/README.i18n.yaml +6 -0
- package/README.md +76 -0
- package/README.zh.md +76 -0
- package/lib/index.js +1026 -0
- package/lib/invariant.js +23 -0
- package/lib/types/index.d.ts +27 -0
- package/lib/types/input.d.ts +170 -0
- package/lib/types/invariant.d.ts +16 -0
- package/lib/types/operations.d.ts +45 -0
- package/lib/types/presentation.d.ts +53 -0
- package/lib/types/service-boundary.d.ts +18 -0
- package/lib/types/workspace-access.d.ts +61 -0
- package/package.json +63 -0
package/lib/invariant.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region lib/types/invariant.js
|
|
2
|
+
/**
|
|
3
|
+
* Package-owned invariant companion for `@deepseek-ai/dsh-tool-session-query`.
|
|
4
|
+
* @module @deepseek-ai/dsh-tool-session-query/invariant
|
|
5
|
+
*/
|
|
6
|
+
const PACKAGE_NAME = "@deepseek-ai/dsh-tool-session-query";
|
|
7
|
+
/** Cordis companion plugin name. */
|
|
8
|
+
const name = "tool-session-query-invariant";
|
|
9
|
+
/** Service required before the companion can reserve package ownership. */
|
|
10
|
+
const inject = ["invariants"];
|
|
11
|
+
/**
|
|
12
|
+
* No runtime invariant: this read-only model adapter owns no event or mutable
|
|
13
|
+
* data relationship beyond the registries that already validate registration.
|
|
14
|
+
*/
|
|
15
|
+
const install = () => {};
|
|
16
|
+
/**
|
|
17
|
+
* Register this package's invariant companion.
|
|
18
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
19
|
+
* @returns the installed registration's disposer after setup succeeds.
|
|
20
|
+
*/
|
|
21
|
+
const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
22
|
+
//#endregion
|
|
23
|
+
export { apply, inject, name };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model-facing, workspace-authorized session-history search and read tools.
|
|
3
|
+
*
|
|
4
|
+
* @module @deepseek-ai/dsh-tool-session-query
|
|
5
|
+
*/
|
|
6
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
7
|
+
import z from '@deepseek-ai/schemastery';
|
|
8
|
+
/** Cordis plugin name used by Loader diagnostics. */
|
|
9
|
+
export declare const name = "tool-session-query";
|
|
10
|
+
/** Capability services required by the model-facing consumer. */
|
|
11
|
+
export declare const inject: string[];
|
|
12
|
+
/** Default maximum number of authorized search hits returned by one call. */
|
|
13
|
+
export declare const DEFAULT_MAX_SEARCH_RESULTS = 100;
|
|
14
|
+
/** Default cooperative deadline for either full-text search tool. */
|
|
15
|
+
export declare const DEFAULT_SEARCH_TIMEOUT_MS = 30000;
|
|
16
|
+
/** Deployment-owned search count and timeout bounds. */
|
|
17
|
+
export interface Config {
|
|
18
|
+
/** Maximum authorized hits returned by one search call. Defaults to 100. */
|
|
19
|
+
maxSearchResults?: number;
|
|
20
|
+
/** Cooperative full-text search deadline in milliseconds. Defaults to 30000. */
|
|
21
|
+
searchTimeoutMs?: number;
|
|
22
|
+
}
|
|
23
|
+
/** Schemastery config for Loader defaults and generated configuration docs. */
|
|
24
|
+
export declare const Config: z<Config>;
|
|
25
|
+
/** Register all five tools and their shared model guidance. */
|
|
26
|
+
export declare function apply(ctx: Context, config: Config): void;
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model argument schemas, normalization, and filter construction.
|
|
3
|
+
*
|
|
4
|
+
* @module @deepseek-ai/dsh-tool-session-query/input
|
|
5
|
+
*/
|
|
6
|
+
import { type SessionId as SessionIdValue } from '@deepseek-ai/dsh-session';
|
|
7
|
+
import { type SessionAvailability, type SessionEventMetadataFilter, type SessionEventSurface, type SessionResultFilter } from '@deepseek-ai/dsh-session-query';
|
|
8
|
+
interface SessionSearchArgs {
|
|
9
|
+
query: string;
|
|
10
|
+
session_ids?: string[];
|
|
11
|
+
created_at_from?: string;
|
|
12
|
+
created_at_to?: string;
|
|
13
|
+
parent_session_ids?: string[];
|
|
14
|
+
include_root_sessions?: boolean;
|
|
15
|
+
availability?: SessionAvailability[];
|
|
16
|
+
event_seq_from?: number;
|
|
17
|
+
event_seq_to?: number;
|
|
18
|
+
event_time_from?: string;
|
|
19
|
+
event_time_to?: string;
|
|
20
|
+
event_types?: string[];
|
|
21
|
+
event_surfaces?: SessionEventSurface[];
|
|
22
|
+
}
|
|
23
|
+
interface EventFilterInput {
|
|
24
|
+
readonly seqFrom?: number | undefined;
|
|
25
|
+
readonly seqTo?: number | undefined;
|
|
26
|
+
readonly timeFrom?: string | undefined;
|
|
27
|
+
readonly timeTo?: string | undefined;
|
|
28
|
+
readonly eventTypes?: string[] | undefined;
|
|
29
|
+
readonly surfaces?: SessionEventSurface[] | undefined;
|
|
30
|
+
}
|
|
31
|
+
declare function buildSessionFilters(args: SessionSearchArgs): SessionResultFilter[];
|
|
32
|
+
declare function materializeParentSessionIds(values: readonly string[] | undefined): SessionIdValue[] | undefined;
|
|
33
|
+
declare function buildEventFilters(input: EventFilterInput): SessionEventMetadataFilter[];
|
|
34
|
+
declare function normalizeQuery(value: string): string;
|
|
35
|
+
declare function sequenceRange(from: number | undefined, to: number | undefined): {
|
|
36
|
+
from?: number;
|
|
37
|
+
to?: number;
|
|
38
|
+
};
|
|
39
|
+
declare function assertNonNegativeSafeInteger(name: string, value: number): void;
|
|
40
|
+
/** Model schemas and model-owned value normalization shared by tool operations. */
|
|
41
|
+
export declare const toolInput: {
|
|
42
|
+
sessionSearchParameters: {
|
|
43
|
+
readonly query: {
|
|
44
|
+
readonly type: "string";
|
|
45
|
+
readonly required: true;
|
|
46
|
+
readonly description: "Literal full-text query over prior session history.";
|
|
47
|
+
};
|
|
48
|
+
readonly session_ids: {
|
|
49
|
+
readonly type: "array";
|
|
50
|
+
readonly items: {
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
};
|
|
53
|
+
readonly description: "Optional session ids to include.";
|
|
54
|
+
};
|
|
55
|
+
readonly created_at_from: {
|
|
56
|
+
readonly type: "string";
|
|
57
|
+
readonly description: "Inclusive timezone-qualified ISO 8601 creation-time lower bound.";
|
|
58
|
+
};
|
|
59
|
+
readonly created_at_to: {
|
|
60
|
+
readonly type: "string";
|
|
61
|
+
readonly description: "Inclusive timezone-qualified ISO 8601 creation-time upper bound.";
|
|
62
|
+
};
|
|
63
|
+
readonly parent_session_ids: {
|
|
64
|
+
readonly type: "array";
|
|
65
|
+
readonly items: {
|
|
66
|
+
readonly type: "string";
|
|
67
|
+
};
|
|
68
|
+
readonly description: "Optional direct parent session ids.";
|
|
69
|
+
};
|
|
70
|
+
readonly include_root_sessions: {
|
|
71
|
+
readonly type: "boolean";
|
|
72
|
+
readonly description: "Include sessions with no parent in the parent filter.";
|
|
73
|
+
};
|
|
74
|
+
readonly availability: {
|
|
75
|
+
readonly type: "array";
|
|
76
|
+
readonly items: {
|
|
77
|
+
readonly type: "string";
|
|
78
|
+
readonly enum: readonly ["live", "persisted"];
|
|
79
|
+
};
|
|
80
|
+
readonly description: "Require at least one selected source availability.";
|
|
81
|
+
};
|
|
82
|
+
readonly event_seq_from: {
|
|
83
|
+
readonly type: "integer";
|
|
84
|
+
readonly description: "Inclusive event sequence lower bound.";
|
|
85
|
+
};
|
|
86
|
+
readonly event_seq_to: {
|
|
87
|
+
readonly type: "integer";
|
|
88
|
+
readonly description: "Inclusive event sequence upper bound.";
|
|
89
|
+
};
|
|
90
|
+
readonly event_time_from: {
|
|
91
|
+
readonly type: "string";
|
|
92
|
+
readonly description: "Inclusive timezone-qualified ISO 8601 event-time lower bound.";
|
|
93
|
+
};
|
|
94
|
+
readonly event_time_to: {
|
|
95
|
+
readonly type: "string";
|
|
96
|
+
readonly description: "Inclusive timezone-qualified ISO 8601 event-time upper bound.";
|
|
97
|
+
};
|
|
98
|
+
readonly event_types: {
|
|
99
|
+
readonly type: "array";
|
|
100
|
+
readonly items: {
|
|
101
|
+
readonly type: "string";
|
|
102
|
+
};
|
|
103
|
+
readonly description: "Event types to include.";
|
|
104
|
+
};
|
|
105
|
+
readonly event_surfaces: {
|
|
106
|
+
readonly type: "array";
|
|
107
|
+
readonly items: {
|
|
108
|
+
readonly type: "string";
|
|
109
|
+
readonly enum: readonly ["current", "shadowed", "log-only"];
|
|
110
|
+
};
|
|
111
|
+
readonly description: "Event surfaces to include.";
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
eventSearchParameters: {
|
|
115
|
+
readonly session_id: {
|
|
116
|
+
readonly type: "string";
|
|
117
|
+
readonly description: "Target session id. Omit for the current session.";
|
|
118
|
+
};
|
|
119
|
+
readonly query: {
|
|
120
|
+
readonly type: "string";
|
|
121
|
+
readonly required: true;
|
|
122
|
+
readonly description: "Literal full-text query over the target session.";
|
|
123
|
+
};
|
|
124
|
+
readonly seq_from: {
|
|
125
|
+
readonly type: "integer";
|
|
126
|
+
readonly description: "Inclusive event sequence lower bound.";
|
|
127
|
+
};
|
|
128
|
+
readonly seq_to: {
|
|
129
|
+
readonly type: "integer";
|
|
130
|
+
readonly description: "Inclusive event sequence upper bound.";
|
|
131
|
+
};
|
|
132
|
+
readonly time_from: {
|
|
133
|
+
readonly type: "string";
|
|
134
|
+
readonly description: "Inclusive timezone-qualified ISO 8601 event-time lower bound.";
|
|
135
|
+
};
|
|
136
|
+
readonly time_to: {
|
|
137
|
+
readonly type: "string";
|
|
138
|
+
readonly description: "Inclusive timezone-qualified ISO 8601 event-time upper bound.";
|
|
139
|
+
};
|
|
140
|
+
readonly event_types: {
|
|
141
|
+
readonly type: "array";
|
|
142
|
+
readonly items: {
|
|
143
|
+
readonly type: "string";
|
|
144
|
+
};
|
|
145
|
+
readonly description: "Event types to include.";
|
|
146
|
+
};
|
|
147
|
+
readonly surfaces: {
|
|
148
|
+
readonly type: "array";
|
|
149
|
+
readonly items: {
|
|
150
|
+
readonly type: "string";
|
|
151
|
+
readonly enum: readonly ["current", "shadowed", "log-only"];
|
|
152
|
+
};
|
|
153
|
+
readonly description: "Event surfaces to include.";
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
targetSessionParameter: {
|
|
157
|
+
readonly session_id: {
|
|
158
|
+
readonly type: "string";
|
|
159
|
+
readonly description: "Target session id. Omit for the current session.";
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
buildSessionFilters: typeof buildSessionFilters;
|
|
163
|
+
materializeParentSessionIds: typeof materializeParentSessionIds;
|
|
164
|
+
buildEventFilters: typeof buildEventFilters;
|
|
165
|
+
normalizeQuery: typeof normalizeQuery;
|
|
166
|
+
sequenceRange: typeof sequenceRange;
|
|
167
|
+
assertNonNegativeSafeInteger: typeof assertNonNegativeSafeInteger;
|
|
168
|
+
};
|
|
169
|
+
export {};
|
|
170
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package-owned invariant companion for `@deepseek-ai/dsh-tool-session-query`.
|
|
3
|
+
* @module @deepseek-ai/dsh-tool-session-query/invariant
|
|
4
|
+
*/
|
|
5
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
6
|
+
/** Cordis companion plugin name. */
|
|
7
|
+
export declare const name = "tool-session-query-invariant";
|
|
8
|
+
/** Service required before the companion can reserve package ownership. */
|
|
9
|
+
export declare const inject: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Register this package's invariant companion.
|
|
12
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
13
|
+
* @returns the installed registration's disposer after setup succeeds.
|
|
14
|
+
*/
|
|
15
|
+
export declare const apply: (ctx: Context) => Promise<() => void>;
|
|
16
|
+
//# sourceMappingURL=invariant.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool operation orchestration over session-query service capabilities.
|
|
3
|
+
*
|
|
4
|
+
* @module @deepseek-ai/dsh-tool-session-query/operations
|
|
5
|
+
*/
|
|
6
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
7
|
+
import { type SessionEventSurface } from '@deepseek-ai/dsh-session-query';
|
|
8
|
+
import type { ToolRunContext } from '@deepseek-ai/dsh-tools';
|
|
9
|
+
import { toolInput } from './input.ts';
|
|
10
|
+
type SessionSearchArgs = Parameters<typeof toolInput.buildSessionFilters>[0];
|
|
11
|
+
interface EventSearchArgs {
|
|
12
|
+
session_id?: string;
|
|
13
|
+
query: string;
|
|
14
|
+
seq_from?: number;
|
|
15
|
+
seq_to?: number;
|
|
16
|
+
time_from?: string;
|
|
17
|
+
time_to?: string;
|
|
18
|
+
event_types?: string[];
|
|
19
|
+
surfaces?: SessionEventSurface[];
|
|
20
|
+
}
|
|
21
|
+
interface SessionTargetArgs {
|
|
22
|
+
session_id?: string;
|
|
23
|
+
}
|
|
24
|
+
interface EventTargetArgs extends SessionTargetArgs {
|
|
25
|
+
seq: number;
|
|
26
|
+
}
|
|
27
|
+
interface EventReadArgs extends EventTargetArgs {
|
|
28
|
+
before?: number;
|
|
29
|
+
after?: number;
|
|
30
|
+
}
|
|
31
|
+
declare function executeSessionSearch(ctx: Context, args: SessionSearchArgs, exec: ToolRunContext, maxResults: number): Promise<string>;
|
|
32
|
+
declare function executeEventSearch(ctx: Context, args: EventSearchArgs, exec: ToolRunContext, maxResults: number): Promise<string>;
|
|
33
|
+
declare function executeSessionTrace(ctx: Context, args: SessionTargetArgs, exec: ToolRunContext): Promise<string>;
|
|
34
|
+
declare function executeEventTrace(ctx: Context, args: EventTargetArgs, exec: ToolRunContext): Promise<string>;
|
|
35
|
+
declare function executeEventRead(ctx: Context, args: EventReadArgs, exec: ToolRunContext): Promise<string>;
|
|
36
|
+
/** Five model-facing session-query operation implementations. */
|
|
37
|
+
export declare const operations: {
|
|
38
|
+
executeSessionSearch: typeof executeSessionSearch;
|
|
39
|
+
executeEventSearch: typeof executeEventSearch;
|
|
40
|
+
executeSessionTrace: typeof executeSessionTrace;
|
|
41
|
+
executeEventTrace: typeof executeEventTrace;
|
|
42
|
+
executeEventRead: typeof executeEventRead;
|
|
43
|
+
};
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model text rendering and generic tool-call presentation.
|
|
3
|
+
*
|
|
4
|
+
* @module @deepseek-ai/dsh-tool-session-query/presentation
|
|
5
|
+
*/
|
|
6
|
+
import { type SessionEventSearchHit, type SessionEventTraceObservation, type SessionEventWindow, type SessionLineageTrace, type SessionRecord, type SessionSearchHit } from '@deepseek-ai/dsh-session-query';
|
|
7
|
+
import type { SessionId } from '@deepseek-ai/dsh-session';
|
|
8
|
+
import type { GenericCallView } from '@deepseek-ai/dsh-tools';
|
|
9
|
+
import { workspaceAccess } from './workspace-access.ts';
|
|
10
|
+
type TitleView = Awaited<ReturnType<typeof workspaceAccess.readTitle>>;
|
|
11
|
+
type CompleteTitleMap = Awaited<ReturnType<typeof workspaceAccess.readTitles>>;
|
|
12
|
+
type AuthorizedDescendants = ReturnType<typeof workspaceAccess.authorizeDescendants>;
|
|
13
|
+
interface SearchCollection<T> {
|
|
14
|
+
readonly items: T[];
|
|
15
|
+
readonly capped: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface SessionSearchCallArgs {
|
|
18
|
+
readonly query: string;
|
|
19
|
+
}
|
|
20
|
+
interface EventSearchCallArgs {
|
|
21
|
+
readonly query: string;
|
|
22
|
+
}
|
|
23
|
+
interface SessionTargetCallArgs {
|
|
24
|
+
readonly session_id?: string;
|
|
25
|
+
}
|
|
26
|
+
interface EventTargetCallArgs extends SessionTargetCallArgs {
|
|
27
|
+
readonly seq: number;
|
|
28
|
+
}
|
|
29
|
+
declare function formatSessionSearch(collected: SearchCollection<SessionSearchHit>, titles: CompleteTitleMap, authorizedParents: ReadonlySet<SessionId>): string;
|
|
30
|
+
declare function formatEmptySessionSearch(): string;
|
|
31
|
+
declare function formatEventSearch(sessionId: SessionId, title: TitleView, collected: SearchCollection<SessionEventSearchHit>): string;
|
|
32
|
+
declare function formatSessionTrace(trace: SessionLineageTrace, ancestors: readonly SessionRecord[], ancestorBoundary: boolean, descendants: AuthorizedDescendants, titles: CompleteTitleMap): string;
|
|
33
|
+
declare function formatEventTrace(sessionId: SessionId, title: TitleView, trace: SessionEventTraceObservation): string;
|
|
34
|
+
declare function formatEventRead(sessionId: SessionId, title: TitleView, window: SessionEventWindow): string;
|
|
35
|
+
declare function presentSessionSearchCall(args: SessionSearchCallArgs): GenericCallView;
|
|
36
|
+
declare function presentEventSearchCall(args: EventSearchCallArgs): GenericCallView;
|
|
37
|
+
declare function presentSessionTraceCall(args: SessionTargetCallArgs): GenericCallView;
|
|
38
|
+
declare function presentEventTargetCall(action: string, args: EventTargetCallArgs): GenericCallView;
|
|
39
|
+
/** Text output and call-card presentation for every session-query tool. */
|
|
40
|
+
export declare const presentation: {
|
|
41
|
+
formatSessionSearch: typeof formatSessionSearch;
|
|
42
|
+
formatEmptySessionSearch: typeof formatEmptySessionSearch;
|
|
43
|
+
formatEventSearch: typeof formatEventSearch;
|
|
44
|
+
formatSessionTrace: typeof formatSessionTrace;
|
|
45
|
+
formatEventTrace: typeof formatEventTrace;
|
|
46
|
+
formatEventRead: typeof formatEventRead;
|
|
47
|
+
presentSessionSearchCall: typeof presentSessionSearchCall;
|
|
48
|
+
presentEventSearchCall: typeof presentEventSearchCall;
|
|
49
|
+
presentSessionTraceCall: typeof presentSessionTraceCall;
|
|
50
|
+
presentEventTargetCall: typeof presentEventTargetCall;
|
|
51
|
+
};
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=presentation.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session-query service error containment and model-safe translation.
|
|
3
|
+
*
|
|
4
|
+
* @module @deepseek-ai/dsh-tool-session-query/service-boundary
|
|
5
|
+
*/
|
|
6
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
7
|
+
import { HarnessError } from '@deepseek-ai/dsh-llm';
|
|
8
|
+
declare function unauthorizedTarget(): HarnessError;
|
|
9
|
+
declare function call<Value>(ctx: Context, signal: AbortSignal, operation: string, invoke: () => Promise<Value>): Promise<Value>;
|
|
10
|
+
declare function sanitizeError(ctx: Context, operation: string, error: unknown): HarnessError;
|
|
11
|
+
/** Model-safe session-query invocation and error translation boundary. */
|
|
12
|
+
export declare const serviceBoundary: {
|
|
13
|
+
unauthorizedTarget: typeof unauthorizedTarget;
|
|
14
|
+
call: typeof call;
|
|
15
|
+
sanitizeError: typeof sanitizeError;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=service-boundary.d.ts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Caller identity, workspace authorization, and visible lineage projection.
|
|
3
|
+
*
|
|
4
|
+
* @module @deepseek-ai/dsh-tool-session-query/workspace-access
|
|
5
|
+
*/
|
|
6
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
7
|
+
import { type SessionEvent, type SessionHeader, type SessionId as SessionIdValue } from '@deepseek-ai/dsh-session';
|
|
8
|
+
import type { SessionLineageNode, SessionRecord } from '@deepseek-ai/dsh-session-query';
|
|
9
|
+
import type { ToolRunContext } from '@deepseek-ai/dsh-tools';
|
|
10
|
+
interface Caller {
|
|
11
|
+
readonly id: SessionIdValue;
|
|
12
|
+
readonly header: SessionHeader;
|
|
13
|
+
readonly events: readonly SessionEvent[];
|
|
14
|
+
}
|
|
15
|
+
interface TitleView {
|
|
16
|
+
readonly text: string;
|
|
17
|
+
readonly unavailableCode?: string;
|
|
18
|
+
}
|
|
19
|
+
interface CompleteTitleMap extends ReadonlyMap<SessionIdValue, TitleView> {
|
|
20
|
+
get(id: SessionIdValue): TitleView;
|
|
21
|
+
}
|
|
22
|
+
interface AuthorizedDescendant {
|
|
23
|
+
readonly record: SessionRecord;
|
|
24
|
+
readonly descendants: Array<AuthorizedDescendant | null>;
|
|
25
|
+
}
|
|
26
|
+
interface DescendantVisit {
|
|
27
|
+
readonly node: AuthorizedDescendant | null;
|
|
28
|
+
readonly depth: number;
|
|
29
|
+
readonly next: DescendantVisit | undefined;
|
|
30
|
+
}
|
|
31
|
+
declare function callerOf(exec: ToolRunContext): Caller;
|
|
32
|
+
declare function targetId(args: {
|
|
33
|
+
readonly session_id?: string;
|
|
34
|
+
}, caller: Caller): SessionIdValue;
|
|
35
|
+
declare function authorizeTarget(ctx: Context, caller: Caller, target: SessionIdValue, signal: AbortSignal): Promise<void>;
|
|
36
|
+
declare function recordAuthorized(record: SessionRecord, caller: Caller): boolean;
|
|
37
|
+
declare function assertObservedTargetAuthorized(caller: Caller, target: SessionIdValue, observed: SessionHeader): void;
|
|
38
|
+
declare function authorizeSessionIds(ctx: Context, caller: Caller, ids: readonly SessionIdValue[], signal: AbortSignal): Promise<ReadonlySet<SessionIdValue>>;
|
|
39
|
+
declare function readTitles(ctx: Context, caller: Caller, ids: readonly SessionIdValue[], signal: AbortSignal): Promise<CompleteTitleMap>;
|
|
40
|
+
declare function readTitle(ctx: Context, caller: Caller, id: SessionIdValue, signal: AbortSignal): Promise<TitleView>;
|
|
41
|
+
declare function authorizeDescendants(nodes: readonly SessionLineageNode[], caller: Caller): Array<AuthorizedDescendant | null>;
|
|
42
|
+
declare function visitDescendants(nodes: readonly (AuthorizedDescendant | null)[]): Generator<DescendantVisit>;
|
|
43
|
+
declare function descendantIds(nodes: readonly (AuthorizedDescendant | null)[]): SessionIdValue[];
|
|
44
|
+
declare function titleText(view: TitleView): string;
|
|
45
|
+
/** Workspace-scoped caller authorization, title access, and lineage projection. */
|
|
46
|
+
export declare const workspaceAccess: {
|
|
47
|
+
callerOf: typeof callerOf;
|
|
48
|
+
targetId: typeof targetId;
|
|
49
|
+
authorizeTarget: typeof authorizeTarget;
|
|
50
|
+
recordAuthorized: typeof recordAuthorized;
|
|
51
|
+
assertObservedTargetAuthorized: typeof assertObservedTargetAuthorized;
|
|
52
|
+
authorizeSessionIds: typeof authorizeSessionIds;
|
|
53
|
+
readTitles: typeof readTitles;
|
|
54
|
+
readTitle: typeof readTitle;
|
|
55
|
+
authorizeDescendants: typeof authorizeDescendants;
|
|
56
|
+
visitDescendants: typeof visitDescendants;
|
|
57
|
+
descendantIds: typeof descendantIds;
|
|
58
|
+
titleText: typeof titleText;
|
|
59
|
+
};
|
|
60
|
+
export {};
|
|
61
|
+
//# sourceMappingURL=workspace-access.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@deepseek-ai/dsh-tool-session-query",
|
|
3
|
+
"description": "Workspace-authorized model-facing session history search, trace, and event read tools",
|
|
4
|
+
"version": "0.0.1-rc.1",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "restricted"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
|
|
11
|
+
"directory": "packages/session-query/tool-session-query"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"types": "lib/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./invariant": {
|
|
22
|
+
"types": "./lib/types/invariant.d.ts",
|
|
23
|
+
"default": "./lib/invariant.js"
|
|
24
|
+
},
|
|
25
|
+
"./src/*": "./src/*",
|
|
26
|
+
"./package.json": "./package.json"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"lib/index.js",
|
|
30
|
+
"lib/invariant.js",
|
|
31
|
+
"lib/types/**/*.d.ts"
|
|
32
|
+
],
|
|
33
|
+
"license": "BSD-3-Clause",
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@deepseek-ai/dsh-invariants": "^0.0.1-rc.1",
|
|
36
|
+
"@deepseek-ai/dsh-session": "^0.0.1-rc.1",
|
|
37
|
+
"@deepseek-ai/dsh-session-query": "^0.0.1-rc.1",
|
|
38
|
+
"@deepseek-ai/dsh-system-prompt": "^0.0.1-rc.1",
|
|
39
|
+
"@deepseek-ai/dsh-timeout": "^0.0.1-rc.1",
|
|
40
|
+
"@deepseek-ai/cordis": "^4.0.1-rc.1",
|
|
41
|
+
"@deepseek-ai/dsh-tools": "^0.0.1-rc.1",
|
|
42
|
+
"@deepseek-ai/dsh-llm": "^0.0.1-rc.1"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@deepseek-ai/schemastery": "^3.18.1-rc.1"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@deepseek-ai/dsh-agent": "^0.0.1-rc.1",
|
|
49
|
+
"@deepseek-ai/dsh-invariants": "^0.0.1-rc.1",
|
|
50
|
+
"@deepseek-ai/dsh-llm": "^0.0.1-rc.1",
|
|
51
|
+
"@deepseek-ai/dsh-session": "^0.0.1-rc.1",
|
|
52
|
+
"@deepseek-ai/dsh-session-persistence": "^0.0.1-rc.1",
|
|
53
|
+
"@deepseek-ai/dsh-session-persistence-jsonl": "^0.0.1-rc.1",
|
|
54
|
+
"@deepseek-ai/dsh-session-query": "^0.0.1-rc.1",
|
|
55
|
+
"@deepseek-ai/dsh-session-query-sqlite": "^0.0.1-rc.1",
|
|
56
|
+
"@deepseek-ai/dsh-session-title": "^0.0.1-rc.1",
|
|
57
|
+
"@deepseek-ai/dsh-timeout": "^0.0.1-rc.1",
|
|
58
|
+
"@deepseek-ai/dsh-timeout-policy": "^0.0.1-rc.1",
|
|
59
|
+
"@deepseek-ai/dsh-tools": "^0.0.1-rc.1",
|
|
60
|
+
"@deepseek-ai/cordis": "^4.0.1-rc.1",
|
|
61
|
+
"@deepseek-ai/dsh-system-prompt": "^0.0.1-rc.1"
|
|
62
|
+
}
|
|
63
|
+
}
|