showrunner-agent-staging 0.2.3-staging.1280 → 0.2.4-staging.1282
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/src/adapter-runner.js +3 -0
- package/dist/src/adapter.d.ts +2 -1
- package/dist/src/agent-tools.d.ts +6 -1
- package/dist/src/client.d.ts +2 -1
- package/dist/src/client.js +21 -1
- package/dist/src/context-tools.d.ts +3 -0
- package/dist/src/context-tools.js +10 -0
- package/dist/src/protocol.d.ts +10 -0
- package/dist/src/protocol.js +4 -0
- package/package.json +1 -1
|
@@ -134,6 +134,9 @@ class InvocationAdapterClient {
|
|
|
134
134
|
listFolderContents(folderId, cursor) {
|
|
135
135
|
return this.#client.listFolderContents(this.#event.invocation.id, folderId, cursor);
|
|
136
136
|
}
|
|
137
|
+
listNotes(cursor) {
|
|
138
|
+
return this.#client.listNotes(this.#event.invocation.id, cursor);
|
|
139
|
+
}
|
|
137
140
|
listFolders(streamId, cursor) {
|
|
138
141
|
return this.#client.listFolders(this.#event.invocation.id, streamId, cursor);
|
|
139
142
|
}
|
package/dist/src/adapter.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ContextFolders, ContextFolderContents } from "./protocol.js";
|
|
1
|
+
import type { ContextNotes, ContextFolders, ContextFolderContents } from "./protocol.js";
|
|
2
2
|
import type { ActivityOutcome, ActivityType, AgentEvent, AgentInputResponse, ApprovalDecision, ApprovalRiskLevel, CommandResponse, ContextAsset, ContextPage, FileDownloadLink, OutputMessagePiece, QuestionSelectionType } from "./protocol.js";
|
|
3
3
|
import type { Note, TextAttachment } from "./protocol.js";
|
|
4
4
|
export type ContextPageOptions = {
|
|
@@ -116,6 +116,7 @@ export interface AdapterClient {
|
|
|
116
116
|
readRecentContext(options: ContextPageOptions): Promise<ContextPage>;
|
|
117
117
|
searchContext(query: string, options: ContextPageOptions): Promise<ContextPage>;
|
|
118
118
|
listFolderContents(folderId: string, cursor?: string | null): Promise<ContextFolderContents>;
|
|
119
|
+
listNotes(cursor?: string | null): Promise<ContextNotes>;
|
|
119
120
|
listFolders(streamId?: string, cursor?: string | null): Promise<ContextFolders>;
|
|
120
121
|
readAsset(assetId: string): Promise<ContextAsset>;
|
|
121
122
|
uploadFile(input: {
|
|
@@ -22,6 +22,9 @@ export declare const agentToolSchemas: {
|
|
|
22
22
|
folderId: z.ZodString;
|
|
23
23
|
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
24
24
|
}, z.core.$strip>;
|
|
25
|
+
readonly list_notes: z.ZodObject<{
|
|
26
|
+
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
27
|
+
}, z.core.$strip>;
|
|
25
28
|
readonly list_folders: z.ZodObject<{
|
|
26
29
|
streamId: z.ZodOptional<z.ZodString>;
|
|
27
30
|
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -195,7 +198,7 @@ export declare const agentToolSchemas: {
|
|
|
195
198
|
};
|
|
196
199
|
export type AgentToolName = keyof typeof agentToolSchemas;
|
|
197
200
|
export declare const agentToolDefinitions: {
|
|
198
|
-
name: "read_thread" | "read_recent" | "search_workspace" | "list_folder_contents" | "list_folders" | "read_asset" | "upload_file" | "read_note" | "create_note" | "update_note" | "create_task" | "update_task" | "update_task_schedule" | "complete_task";
|
|
201
|
+
name: "read_thread" | "read_recent" | "search_workspace" | "list_folder_contents" | "list_notes" | "list_folders" | "read_asset" | "upload_file" | "read_note" | "create_note" | "update_note" | "create_task" | "update_task" | "update_task_schedule" | "complete_task";
|
|
199
202
|
description: string;
|
|
200
203
|
inputSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
|
|
201
204
|
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -210,6 +213,8 @@ export declare const agentToolDefinitions: {
|
|
|
210
213
|
}, z.core.$strip> | z.ZodObject<{
|
|
211
214
|
folderId: z.ZodString;
|
|
212
215
|
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
216
|
+
}, z.core.$strip> | z.ZodObject<{
|
|
217
|
+
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
213
218
|
}, z.core.$strip> | z.ZodObject<{
|
|
214
219
|
streamId: z.ZodOptional<z.ZodString>;
|
|
215
220
|
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
package/dist/src/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ContextFolders, ContextFolderContents } from "./protocol.js";
|
|
1
|
+
import type { ContextNotes, ContextFolders, ContextFolderContents } from "./protocol.js";
|
|
2
2
|
import * as signalR from "@microsoft/signalr";
|
|
3
3
|
import type { AgentEventHandler } from "./handler.js";
|
|
4
4
|
import type { AgentModelOption, HostToolCapability, HostToolGrantKey } from "./adapter.js";
|
|
@@ -202,6 +202,7 @@ export declare class ExternalAgentClient {
|
|
|
202
202
|
cursor?: string | null;
|
|
203
203
|
limit?: number;
|
|
204
204
|
}): Promise<ContextPage>;
|
|
205
|
+
listNotes(invocationId: string, cursor?: string | null): Promise<ContextNotes>;
|
|
205
206
|
listFolders(invocationId: string, streamId?: string, cursor?: string | null): Promise<ContextFolders>;
|
|
206
207
|
listFolderContents(invocationId: string, folderId: string, cursor?: string | null): Promise<ContextFolderContents>;
|
|
207
208
|
readAsset(invocationId: string, assetId: string): Promise<ContextAsset>;
|
package/dist/src/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { contextFoldersSchema, contextFolderContentsSchema } from "./protocol.js";
|
|
1
|
+
import { contextNotesSchema, contextFoldersSchema, contextFolderContentsSchema } from "./protocol.js";
|
|
2
2
|
import * as signalR from "@microsoft/signalr";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { resolveAdapterModels } from "./adapter.js";
|
|
@@ -337,6 +337,26 @@ export class ExternalAgentClient {
|
|
|
337
337
|
q: query,
|
|
338
338
|
});
|
|
339
339
|
}
|
|
340
|
+
async listNotes(invocationId, cursor) {
|
|
341
|
+
const params = new URLSearchParams();
|
|
342
|
+
if (cursor != null) {
|
|
343
|
+
params.set("cursor", cursor);
|
|
344
|
+
}
|
|
345
|
+
const token = await this.accessToken();
|
|
346
|
+
const response = await this.#fetch(`${this.#apiBaseUrl}/api/external-agent-gateway/v1/invocations/${invocationId}/context/notes?${params.toString()}`, {
|
|
347
|
+
method: "GET",
|
|
348
|
+
headers: {
|
|
349
|
+
Authorization: `Bearer ${token}`,
|
|
350
|
+
"X-Showrunner-Connector-Version": this.#connectorVersion,
|
|
351
|
+
"X-Showrunner-Protocol": "1.0",
|
|
352
|
+
},
|
|
353
|
+
signal: AbortSignal.timeout(30_000),
|
|
354
|
+
});
|
|
355
|
+
if (!response.ok) {
|
|
356
|
+
throw new ExternalAgentError(`http_${response.status}`, "Connector note request failed.", response.status);
|
|
357
|
+
}
|
|
358
|
+
return contextNotesSchema.parse(await response.json());
|
|
359
|
+
}
|
|
340
360
|
async listFolders(invocationId, streamId, cursor) {
|
|
341
361
|
const params = new URLSearchParams();
|
|
342
362
|
if (streamId !== undefined) {
|
|
@@ -18,6 +18,9 @@ export declare const contextToolSchemas: {
|
|
|
18
18
|
folderId: z.ZodString;
|
|
19
19
|
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
20
20
|
}, z.core.$strip>;
|
|
21
|
+
readonly list_notes: z.ZodObject<{
|
|
22
|
+
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
23
|
+
}, z.core.$strip>;
|
|
21
24
|
readonly list_folders: z.ZodObject<{
|
|
22
25
|
streamId: z.ZodOptional<z.ZodString>;
|
|
23
26
|
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -16,6 +16,7 @@ export const contextToolSchemas = {
|
|
|
16
16
|
folderId: uuidSchema.describe("Folder ID returned by list_folders."),
|
|
17
17
|
cursor: uuidSchema.nullable().optional().describe("nextCursor from the previous contents page."),
|
|
18
18
|
}),
|
|
19
|
+
list_notes: z.object({ cursor: uuidSchema.nullable().optional().describe("nextCursor from the previous notes page.") }),
|
|
19
20
|
list_folders: z.object({
|
|
20
21
|
streamId: uuidSchema.optional().describe("A reachable chat ID. Omit for this conversation."),
|
|
21
22
|
cursor: uuidSchema.nullable().optional().describe("nextCursor from the previous folder page."),
|
|
@@ -40,6 +41,8 @@ export function contextToolDescription(name) {
|
|
|
40
41
|
+ "Every result carries a messageId you can cite back as a message_reference pill.";
|
|
41
42
|
case "list_folder_contents":
|
|
42
43
|
return "List direct subfolders, files and links in a reachable folder. itemType: 0 folder, 1 file, 2 link. Use folder IDs to navigate, asset IDs with read_asset. Pass nextCursor to continue. Does not list notes or tasks.";
|
|
44
|
+
case "list_notes":
|
|
45
|
+
return "List readable notes referenced in this conversation, plus notes this agent created here. Returns IDs, source chat, title and version; use read_note for bodies. Does not discover unreferenced workspace notes. Pass nextCursor to continue.";
|
|
43
46
|
case "list_folders":
|
|
44
47
|
return "List folders in a reachable chat with IDs, names, parent IDs and file counts. Pass nextCursor to continue.";
|
|
45
48
|
case "read_asset":
|
|
@@ -56,6 +59,7 @@ export function contextToolEffect(name, input) {
|
|
|
56
59
|
return `Search workspace messages for ${query}`;
|
|
57
60
|
}
|
|
58
61
|
case "list_folder_contents": return "List contents of a reachable folder";
|
|
62
|
+
case "list_notes": return "List notes readable from this conversation";
|
|
59
63
|
case "list_folders": return "List folders in a reachable chat";
|
|
60
64
|
case "read_asset": {
|
|
61
65
|
const id = typeof input.assetId === "string" ? input.assetId : "by id";
|
|
@@ -73,6 +77,7 @@ export function contextReadIsWithinGrant(name, scope) {
|
|
|
73
77
|
return true;
|
|
74
78
|
}
|
|
75
79
|
switch (name) {
|
|
80
|
+
case "list_notes": return scope.canReadNotes;
|
|
76
81
|
case "read_thread": return scope.canReadThreadHistory;
|
|
77
82
|
case "read_recent": return scope.canReadRecentMessages;
|
|
78
83
|
case "search_workspace": return scope.canSearch;
|
|
@@ -94,6 +99,7 @@ export function contextToolApprovalBody(name, scope) {
|
|
|
94
99
|
return `Read messages in ${target}`;
|
|
95
100
|
case "search_workspace":
|
|
96
101
|
return `Search messages in ${target}`;
|
|
102
|
+
case "list_notes": return `List readable notes in ${target}`;
|
|
97
103
|
case "list_folder_contents":
|
|
98
104
|
case "list_folders": return `Read folders accessible from ${target}`;
|
|
99
105
|
case "read_asset":
|
|
@@ -118,6 +124,10 @@ export async function executeContextTool(context, name, untrusted) {
|
|
|
118
124
|
const input = contextToolSchemas.list_folder_contents.parse(untrusted);
|
|
119
125
|
return toolSuccess(await context.client.listFolderContents(input.folderId, input.cursor));
|
|
120
126
|
}
|
|
127
|
+
if (name === "list_notes") {
|
|
128
|
+
const input = contextToolSchemas.list_notes.parse(untrusted);
|
|
129
|
+
return toolSuccess(await context.client.listNotes(input.cursor));
|
|
130
|
+
}
|
|
121
131
|
if (name === "list_folders") {
|
|
122
132
|
const input = contextToolSchemas.list_folders.parse(untrusted);
|
|
123
133
|
return toolSuccess(await context.client.listFolders(input.streamId, input.cursor));
|
package/dist/src/protocol.d.ts
CHANGED
|
@@ -677,4 +677,14 @@ export declare const contextFolderContentsSchema: z.ZodObject<{
|
|
|
677
677
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
678
678
|
}, z.core.$strip>;
|
|
679
679
|
export type ContextFolderContents = z.infer<typeof contextFolderContentsSchema>;
|
|
680
|
+
export declare const contextNotesSchema: z.ZodObject<{
|
|
681
|
+
notes: z.ZodArray<z.ZodObject<{
|
|
682
|
+
noteId: z.ZodString;
|
|
683
|
+
streamId: z.ZodString;
|
|
684
|
+
title: z.ZodNullable<z.ZodString>;
|
|
685
|
+
version: z.ZodNumber;
|
|
686
|
+
}, z.core.$strip>>;
|
|
687
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
688
|
+
}, z.core.$strip>;
|
|
689
|
+
export type ContextNotes = z.infer<typeof contextNotesSchema>;
|
|
680
690
|
export {};
|
package/dist/src/protocol.js
CHANGED
|
@@ -380,3 +380,7 @@ export const contextFolderContentsSchema = z.object({
|
|
|
380
380
|
})),
|
|
381
381
|
nextCursor: z.string().uuid().nullable(),
|
|
382
382
|
});
|
|
383
|
+
export const contextNotesSchema = z.object({
|
|
384
|
+
notes: z.array(z.object({ noteId: z.string().uuid(), streamId: z.string().uuid(), title: z.string().nullable(), version: z.number().int() })),
|
|
385
|
+
nextCursor: z.string().uuid().nullable(),
|
|
386
|
+
});
|