dsh-capability-panel 1.0.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/lib/index.d.ts ADDED
@@ -0,0 +1,188 @@
1
+ //#region src/loopback.d.ts
2
+ /** The minimal readable surface of a request object inside a route handler. */
3
+ interface IncomingLike {
4
+ readonly url?: string;
5
+ readonly method?: string;
6
+ readonly headers: Record<string, string | string[] | undefined>;
7
+ /**
8
+ * Present on node's http.IncomingMessage. Prefer it for the loopback
9
+ * decision: the Host and Origin headers are client-controlled and forgeable.
10
+ */
11
+ readonly socket?: {
12
+ readonly remoteAddress?: string;
13
+ };
14
+ }
15
+ //#endregion
16
+ //#region src/host/types.d.ts
17
+
18
+ interface AgentsService {
19
+ get(sessionId: string): AgentLike | undefined;
20
+ }
21
+ interface AgentPresetLike {
22
+ readonly id: string;
23
+ readonly trust: 'system' | 'user';
24
+ readonly name?: string;
25
+ readonly description?: string;
26
+ readonly broken?: string;
27
+ }
28
+ interface AgentPresetsService {
29
+ list(): Promise<AgentPresetLike[]>;
30
+ standingKeyFor(id?: string): Promise<unknown>;
31
+ composedPreset(agentCtx: unknown): string | undefined;
32
+ }
33
+ interface SettingsScopeLike<T> {
34
+ get(): T;
35
+ /**
36
+ * Wholesale replacement of this namespace's user section. The merge behind
37
+ * `update` recurses, so it cannot remove a key; removal is why this is the
38
+ * write path used here.
39
+ */
40
+ replace(section: object): Promise<void>;
41
+ }
42
+ interface SettingsService {
43
+ readonly writable: boolean;
44
+ register<T>(namespace: string, schema: unknown, options?: {
45
+ applies?: 'live' | 'restart';
46
+ }): SettingsScopeLike<T>;
47
+ }
48
+ interface SkillsService {
49
+ list(lookup: {
50
+ cwd?: string;
51
+ scope?: unknown;
52
+ }): Promise<readonly SkillSummary[]>;
53
+ get(name: string, lookup: {
54
+ cwd?: string;
55
+ scope?: unknown;
56
+ }): Promise<SkillDefinitionLike | undefined>;
57
+ }
58
+ interface ToolsService {
59
+ schemas(scope?: unknown): Iterable<{
60
+ name?: unknown;
61
+ description?: unknown;
62
+ }>;
63
+ guard?(guard: (execution: {
64
+ name?: unknown;
65
+ agent?: {
66
+ id?: unknown;
67
+ };
68
+ }) => string | undefined): () => void;
69
+ }
70
+ /** The `agent/created` payload, named so a listener wrapper can restate it. */
71
+ interface AgentCreatedPayload {
72
+ readonly agent: AgentLike & {
73
+ readonly id?: unknown;
74
+ readonly ctx: {
75
+ get(name: 'tools'): ScopedToolsRegistry | undefined;
76
+ };
77
+ };
78
+ }
79
+ interface HostServices {
80
+ readonly webServer?: {
81
+ register(spec: {
82
+ kind: 'prefix';
83
+ path: string;
84
+ handler: (req: IncomingLike$1, res: ServerResponseLike) => Promise<void> | void;
85
+ }): () => void;
86
+ };
87
+ get(name: 'agents'): AgentsService | undefined;
88
+ get(name: 'agentPresets'): AgentPresetsService | undefined;
89
+ get(name: 'settings'): SettingsService | undefined;
90
+ get(name: 'skills'): SkillsService | undefined;
91
+ get(name: 'tools'): ToolsService | undefined;
92
+ on(event: 'agent/created',
93
+ /**
94
+ * A returned promise is allowed on purpose. Cordis vetoes agent publication
95
+ * on a SYNCHRONOUS listener failure but only reports a rejected promise, so
96
+ * asynchronous work here cannot cost the user their session. The synchronous
97
+ * part of a listener still has to contain its own failures.
98
+ */
99
+ listener: (payload: AgentCreatedPayload) => void | Promise<void>): void;
100
+ on(event: 'tools/result', listener: (exec: {
101
+ name?: unknown;
102
+ arguments?: unknown;
103
+ agent?: {
104
+ id?: unknown;
105
+ };
106
+ }, result: {
107
+ isError: boolean;
108
+ error?: {
109
+ message?: unknown;
110
+ info?: {
111
+ code?: unknown;
112
+ };
113
+ };
114
+ }) => void): void;
115
+ on(event: 'system-prompt/assemble', listener: (assembly: {
116
+ tools?: readonly {
117
+ name?: unknown;
118
+ }[];
119
+ }, context: {
120
+ agent?: {
121
+ id?: unknown;
122
+ };
123
+ }, next: () => Promise<{
124
+ tools?: readonly {
125
+ name?: unknown;
126
+ }[];
127
+ }>) => Promise<{
128
+ tools?: readonly {
129
+ name?: unknown;
130
+ }[];
131
+ }>): void;
132
+ effect(factory: () => (() => void) | void, label?: string): void;
133
+ }
134
+ interface ScopedToolsRegistry {
135
+ restrict(filter: {
136
+ deny: readonly string[];
137
+ }): () => void;
138
+ }
139
+ interface AgentLike {
140
+ readonly session?: {
141
+ readonly header?: {
142
+ readonly cwd?: string;
143
+ };
144
+ /**
145
+ * Live in-memory log view, present on every real Session. Borrowed
146
+ * references, zero-copy — the panel scans this instead of asking a query
147
+ * service to clone and replay-validate the whole log.
148
+ */
149
+ readonly snapshotEvents?: () => readonly unknown[];
150
+ /** Incrementally maintained current surface: seqs the model sees now. */
151
+ readonly surface?: {
152
+ readonly nodes?: readonly unknown[];
153
+ };
154
+ };
155
+ readonly ctx?: {
156
+ get(name: string): unknown;
157
+ };
158
+ }
159
+ interface SkillSummary {
160
+ readonly name?: unknown;
161
+ readonly description?: unknown;
162
+ readonly invocation?: {
163
+ readonly modelInvocable?: unknown;
164
+ };
165
+ }
166
+ interface SkillDefinitionLike {
167
+ readonly name?: unknown;
168
+ readonly description?: unknown;
169
+ readonly content?: unknown;
170
+ readonly resourceBase?: unknown;
171
+ }
172
+ interface IncomingLike$1 extends IncomingLike {
173
+ on?(event: 'data', listener: (chunk: unknown) => void): void;
174
+ on?(event: 'end', listener: () => void): void;
175
+ on?(event: 'error', listener: (error: unknown) => void): void;
176
+ }
177
+ interface ServerResponseLike {
178
+ writeHead(status: number, headers: Record<string, string>): void;
179
+ end(body?: string): void;
180
+ }
181
+ //#endregion
182
+ //#region src/index.d.ts
183
+ /** Host composition root: construct stores/controllers and register the route. */
184
+ declare function apply(ctx: HostServices): void;
185
+ declare const inject: string[];
186
+ //#endregion
187
+ export { apply, inject };
188
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/loopback.ts","../src/host/types.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;AACiB,UAAA,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