showrunner-agent-staging 0.2.2-staging.1274 → 0.2.3-staging.1275

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.
@@ -131,6 +131,9 @@ class InvocationAdapterClient {
131
131
  searchContext(query, options) {
132
132
  return this.#client.search(this.#event.invocation.id, query, options);
133
133
  }
134
+ listFolderContents(folderId, cursor) {
135
+ return this.#client.listFolderContents(this.#event.invocation.id, folderId, cursor);
136
+ }
134
137
  listFolders(streamId, cursor) {
135
138
  return this.#client.listFolders(this.#event.invocation.id, streamId, cursor);
136
139
  }
@@ -1,4 +1,4 @@
1
- import type { ContextFolders } from "./protocol.js";
1
+ import type { 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 = {
@@ -115,6 +115,7 @@ export interface AdapterClient {
115
115
  readThreadContext(options: ContextPageOptions): Promise<ContextPage>;
116
116
  readRecentContext(options: ContextPageOptions): Promise<ContextPage>;
117
117
  searchContext(query: string, options: ContextPageOptions): Promise<ContextPage>;
118
+ listFolderContents(folderId: string, cursor?: string | null): Promise<ContextFolderContents>;
118
119
  listFolders(streamId?: string, cursor?: string | null): Promise<ContextFolders>;
119
120
  readAsset(assetId: string): Promise<ContextAsset>;
120
121
  uploadFile(input: {
@@ -18,6 +18,10 @@ export declare const agentToolSchemas: {
18
18
  cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
19
19
  limit: z.ZodOptional<z.ZodNumber>;
20
20
  }, z.core.$strip>;
21
+ readonly list_folder_contents: z.ZodObject<{
22
+ folderId: z.ZodString;
23
+ cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
24
+ }, z.core.$strip>;
21
25
  readonly list_folders: z.ZodObject<{
22
26
  streamId: z.ZodOptional<z.ZodString>;
23
27
  cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -191,7 +195,7 @@ export declare const agentToolSchemas: {
191
195
  };
192
196
  export type AgentToolName = keyof typeof agentToolSchemas;
193
197
  export declare const agentToolDefinitions: {
194
- name: "read_thread" | "read_recent" | "search_workspace" | "list_folders" | "read_asset" | "upload_file" | "read_note" | "create_note" | "update_note" | "create_task" | "update_task" | "update_task_schedule" | "complete_task";
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";
195
199
  description: string;
196
200
  inputSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
197
201
  cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -203,6 +207,9 @@ export declare const agentToolDefinitions: {
203
207
  query: z.ZodString;
204
208
  cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
205
209
  limit: z.ZodOptional<z.ZodNumber>;
210
+ }, z.core.$strip> | z.ZodObject<{
211
+ folderId: z.ZodString;
212
+ cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
206
213
  }, z.core.$strip> | z.ZodObject<{
207
214
  streamId: z.ZodOptional<z.ZodString>;
208
215
  cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -1,4 +1,4 @@
1
- import type { ContextFolders } from "./protocol.js";
1
+ import type { 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";
@@ -203,6 +203,7 @@ export declare class ExternalAgentClient {
203
203
  limit?: number;
204
204
  }): Promise<ContextPage>;
205
205
  listFolders(invocationId: string, streamId?: string, cursor?: string | null): Promise<ContextFolders>;
206
+ listFolderContents(invocationId: string, folderId: string, cursor?: string | null): Promise<ContextFolderContents>;
206
207
  readAsset(invocationId: string, assetId: string): Promise<ContextAsset>;
207
208
  readNote(invocationId: string, noteId: string, input: {
208
209
  commandId: string;
@@ -1,4 +1,4 @@
1
- import { contextFoldersSchema } from "./protocol.js";
1
+ import { 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";
@@ -360,6 +360,26 @@ export class ExternalAgentClient {
360
360
  }
361
361
  return contextFoldersSchema.parse(await response.json());
362
362
  }
363
+ async listFolderContents(invocationId, folderId, cursor) {
364
+ const params = new URLSearchParams();
365
+ if (cursor != null) {
366
+ params.set("cursor", cursor);
367
+ }
368
+ const token = await this.accessToken();
369
+ const response = await this.#fetch(`${this.#apiBaseUrl}/api/external-agent-gateway/v1/invocations/${invocationId}/context/folders/${folderId}?${params.toString()}`, {
370
+ method: "GET",
371
+ headers: {
372
+ Authorization: `Bearer ${token}`,
373
+ "X-Showrunner-Connector-Version": this.#connectorVersion,
374
+ "X-Showrunner-Protocol": "1.0",
375
+ },
376
+ signal: AbortSignal.timeout(30_000),
377
+ });
378
+ if (!response.ok) {
379
+ throw new ExternalAgentError(`http_${response.status}`, "Connector folder request failed.", response.status);
380
+ }
381
+ return contextFolderContentsSchema.parse(await response.json());
382
+ }
363
383
  async readAsset(invocationId, assetId) {
364
384
  const token = await this.accessToken();
365
385
  const response = await this.#fetch(`${this.#apiBaseUrl}/api/external-agent-gateway/v1/invocations/${invocationId}/context/assets/${assetId}`, {
@@ -14,6 +14,10 @@ export declare const contextToolSchemas: {
14
14
  cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
15
15
  limit: z.ZodOptional<z.ZodNumber>;
16
16
  }, z.core.$strip>;
17
+ readonly list_folder_contents: z.ZodObject<{
18
+ folderId: z.ZodString;
19
+ cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
20
+ }, z.core.$strip>;
17
21
  readonly list_folders: z.ZodObject<{
18
22
  streamId: z.ZodOptional<z.ZodString>;
19
23
  cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -12,6 +12,10 @@ export const contextToolSchemas = {
12
12
  cursor: cursorSchema,
13
13
  limit: limitSchema,
14
14
  }),
15
+ list_folder_contents: z.object({
16
+ folderId: uuidSchema.describe("Folder ID returned by list_folders."),
17
+ cursor: uuidSchema.nullable().optional().describe("nextCursor from the previous contents page."),
18
+ }),
15
19
  list_folders: z.object({
16
20
  streamId: uuidSchema.optional().describe("A reachable chat ID. Omit for this conversation."),
17
21
  cursor: uuidSchema.nullable().optional().describe("nextCursor from the previous folder page."),
@@ -34,6 +38,8 @@ export function contextToolDescription(name) {
34
38
  return "Search the messages you can read for keywords. Reach for this the moment a question refers to "
35
39
  + "something older than what you were handed — do not answer \"I don't have that\" without searching first. "
36
40
  + "Every result carries a messageId you can cite back as a message_reference pill.";
41
+ case "list_folder_contents":
42
+ 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.";
37
43
  case "list_folders":
38
44
  return "List folders in a reachable chat with IDs, names, parent IDs and file counts. Pass nextCursor to continue.";
39
45
  case "read_asset":
@@ -49,6 +55,7 @@ export function contextToolEffect(name, input) {
49
55
  const query = typeof input.query === "string" ? input.query.slice(0, 120) : "";
50
56
  return `Search workspace messages for ${query}`;
51
57
  }
58
+ case "list_folder_contents": return "List contents of a reachable folder";
52
59
  case "list_folders": return "List folders in a reachable chat";
53
60
  case "read_asset": {
54
61
  const id = typeof input.assetId === "string" ? input.assetId : "by id";
@@ -69,6 +76,7 @@ export function contextReadIsWithinGrant(name, scope) {
69
76
  case "read_thread": return scope.canReadThreadHistory;
70
77
  case "read_recent": return scope.canReadRecentMessages;
71
78
  case "search_workspace": return scope.canSearch;
79
+ case "list_folder_contents":
72
80
  case "list_folders":
73
81
  case "read_asset": return scope.canReadFiles;
74
82
  }
@@ -86,6 +94,7 @@ export function contextToolApprovalBody(name, scope) {
86
94
  return `Read messages in ${target}`;
87
95
  case "search_workspace":
88
96
  return `Search messages in ${target}`;
97
+ case "list_folder_contents":
89
98
  case "list_folders": return `Read folders accessible from ${target}`;
90
99
  case "read_asset":
91
100
  return `Read file details in ${target}`;
@@ -105,6 +114,10 @@ export async function executeContextTool(context, name, untrusted) {
105
114
  const input = contextToolSchemas.search_workspace.parse(untrusted);
106
115
  return toolSuccess(toModelPage(await context.client.searchContext(input.query, pageOptions(input))));
107
116
  }
117
+ if (name === "list_folder_contents") {
118
+ const input = contextToolSchemas.list_folder_contents.parse(untrusted);
119
+ return toolSuccess(await context.client.listFolderContents(input.folderId, input.cursor));
120
+ }
108
121
  if (name === "list_folders") {
109
122
  const input = contextToolSchemas.list_folders.parse(untrusted);
110
123
  return toolSuccess(await context.client.listFolders(input.streamId, input.cursor));
@@ -666,4 +666,15 @@ export declare const contextFoldersSchema: z.ZodObject<{
666
666
  nextCursor: z.ZodNullable<z.ZodString>;
667
667
  }, z.core.$strip>;
668
668
  export type ContextFolders = z.infer<typeof contextFoldersSchema>;
669
+ export declare const contextFolderContentsSchema: z.ZodObject<{
670
+ folderId: z.ZodString;
671
+ streamId: z.ZodString;
672
+ items: z.ZodArray<z.ZodObject<{
673
+ id: z.ZodString;
674
+ displayName: z.ZodString;
675
+ itemType: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>;
676
+ }, z.core.$strip>>;
677
+ nextCursor: z.ZodNullable<z.ZodString>;
678
+ }, z.core.$strip>;
679
+ export type ContextFolderContents = z.infer<typeof contextFolderContentsSchema>;
669
680
  export {};
@@ -370,3 +370,13 @@ export const contextFoldersSchema = z.object({
370
370
  })),
371
371
  nextCursor: z.string().uuid().nullable(),
372
372
  });
373
+ export const contextFolderContentsSchema = z.object({
374
+ folderId: z.string().uuid(),
375
+ streamId: z.string().uuid(),
376
+ items: z.array(z.object({
377
+ id: z.string().uuid(),
378
+ displayName: z.string(),
379
+ itemType: z.union([z.literal(0), z.literal(1), z.literal(2)]),
380
+ })),
381
+ nextCursor: z.string().uuid().nullable(),
382
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "showrunner-agent-staging",
3
- "version": "0.2.2-staging.1274",
3
+ "version": "0.2.3-staging.1275",
4
4
  "description": "Provider-neutral connector SDK for Showrunner agents",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",