showrunner-agent-staging 0.5.98-staging.1721 → 0.5.98-staging.1723
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.d.ts +2 -1
- package/dist/src/adapter-runner.js +3 -0
- package/dist/src/adapter.d.ts +4 -1
- package/dist/src/agent-tools.d.ts +3 -2
- package/dist/src/agent-tools.js +3 -1
- package/dist/src/approval-policy.d.ts +33 -1
- package/dist/src/approval-policy.js +44 -0
- package/dist/src/client.d.ts +2 -1
- package/dist/src/client.js +17 -1
- package/dist/src/cloud/cloud-server.js +1 -0
- package/dist/src/cloud/cloud-tool-server.d.ts +2 -2
- package/dist/src/context-tools.d.ts +1 -0
- package/dist/src/context-tools.js +40 -0
- package/dist/src/protocol.d.ts +33 -0
- package/dist/src/protocol.js +34 -0
- package/dist/src/tool-activity.js +1 -0
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import type { TaskCreate, TaskUpdate, TaskVersion } from "./task-management-dtos
|
|
|
3
3
|
import type { AgentTranscriptItem, AgentTranscriptTimingsItem } from "@showrunner/agent-contracts/agent-dtos";
|
|
4
4
|
import type { CreateSurfacePieceRequest } from "@showrunner/agent-contracts/agent-write-piece-dtos";
|
|
5
5
|
import type { FileUploadInput } from "./client.js";
|
|
6
|
-
import type { ContextNoteSearch, ContextChats, ContextRootContents, ContextAgents, ContextFileSearch, ContextTodos, ContextNotes, ContextFolders, ContextFolderContents } from "./protocol.js";
|
|
6
|
+
import type { ContextNoteSearch, ContextChats, ContextRootContents, ContextAgents, ContextAccessSummary, ContextFileSearch, ContextTodos, ContextNotes, ContextFolders, ContextFolderContents } from "./protocol.js";
|
|
7
7
|
import { type ExternalAgentClient } from "./client.js";
|
|
8
8
|
import { type AbandonOutcome, type AgentEventContext, type AgentEventProcessor } from "./handler.js";
|
|
9
9
|
import type { AgentEvent, AgentInputResponse, ApprovalDecision, ApprovalRiskLevel, CommandResponse, ContextAsset, ContextPage, OutputMessagePiece, QuestionSelectionType } from "./protocol.js";
|
|
@@ -69,6 +69,7 @@ export declare class InvocationAdapterClient implements AdapterClient {
|
|
|
69
69
|
type: "delegation.completed";
|
|
70
70
|
}>>;
|
|
71
71
|
listAgents(cursor?: string | null): Promise<ContextAgents>;
|
|
72
|
+
describeAccess(): Promise<ContextAccessSummary>;
|
|
72
73
|
searchTasks(query: string, cursor?: string | null): Promise<ContextTodos>;
|
|
73
74
|
searchNotes(query: string, cursor?: string | null): Promise<ContextNoteSearch>;
|
|
74
75
|
listChats(cursor?: string | null, limit?: number): Promise<ContextChats>;
|
|
@@ -300,6 +300,9 @@ export class InvocationAdapterClient {
|
|
|
300
300
|
listAgents(cursor) {
|
|
301
301
|
return this.#client.listAgents(this.#event.invocation.id, cursor);
|
|
302
302
|
}
|
|
303
|
+
describeAccess() {
|
|
304
|
+
return this.#client.describeAccess(this.#event.invocation.id);
|
|
305
|
+
}
|
|
303
306
|
searchTasks(query, cursor) {
|
|
304
307
|
return this.#client.searchTasks(this.#event.invocation.id, query, cursor);
|
|
305
308
|
}
|
package/dist/src/adapter.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { TaskCreate, TaskUpdate, TaskVersion } from "./task-management-dtos
|
|
|
5
5
|
import type { AgentTranscriptItem, AgentTranscriptTimingsItem } from "@showrunner/agent-contracts/agent-dtos";
|
|
6
6
|
import type { CreateSurfacePieceRequest } from "@showrunner/agent-contracts/agent-write-piece-dtos";
|
|
7
7
|
import { type FileUploadInput } from "./client.js";
|
|
8
|
-
import type { ContextNoteSearch, ContextChats, ContextRootContents, ContextAgents, ContextFileSearch, ContextTodos, ContextNotes, ContextFolders, ContextFolderContents } from "./protocol.js";
|
|
8
|
+
import type { ContextNoteSearch, ContextChats, ContextRootContents, ContextAgents, ContextAccessSummary, ContextFileSearch, ContextTodos, ContextNotes, ContextFolders, ContextFolderContents } from "./protocol.js";
|
|
9
9
|
import type { ActivityOutcome, ActivityType, AgentAvailability, AgentEvent, AgentInputResponse, ApprovalDecision, ApprovalRiskLevel, CommandResponse, ContextAsset, ContextPage, CreatedByRunEvidence, FileDownloadLink, OutputMessagePiece, QuestionSelectionType } from "./protocol.js";
|
|
10
10
|
import type { Note, TextAttachment } from "./protocol.js";
|
|
11
11
|
import { type ApprovalFence } from "./approval-policy.js";
|
|
@@ -176,6 +176,7 @@ export interface AdapterClient {
|
|
|
176
176
|
searchContext(query: string, options: ContextPageOptions): Promise<ContextPage>;
|
|
177
177
|
listFolderContents(folderId: string, cursor?: string | null): Promise<ContextFolderContents>;
|
|
178
178
|
listAgents(cursor?: string | null): Promise<ContextAgents>;
|
|
179
|
+
describeAccess(): Promise<ContextAccessSummary>;
|
|
179
180
|
delegate(targetAgentInstallationId: string, instruction: string): Promise<Extract<AgentInputResponse, {
|
|
180
181
|
type: "delegation.completed";
|
|
181
182
|
}>>;
|
|
@@ -269,6 +270,8 @@ export interface AgentInvocationContext {
|
|
|
269
270
|
/** Connector wall-clock time captured before this invocation starts running the provider. */
|
|
270
271
|
runStartedAt?: Date;
|
|
271
272
|
providerKind: AgentAdapterKind;
|
|
273
|
+
/** False when access reports must leave host-tool policy to the remote provider. */
|
|
274
|
+
hostToolsManaged?: boolean;
|
|
272
275
|
externalSessionId: string | null;
|
|
273
276
|
model: string | null;
|
|
274
277
|
reasoningEffort: string | null;
|
|
@@ -5,6 +5,7 @@ import type { AgentInvocationContext, CreatedByRunFileIdentity, HostToolApproval
|
|
|
5
5
|
* Order matters only for prompt readability: expression first, then reading.
|
|
6
6
|
*/
|
|
7
7
|
export declare const agentToolSchemas: {
|
|
8
|
+
readonly describe_access: z.ZodObject<{}, z.core.$strip>;
|
|
8
9
|
readonly get_transcripts: z.ZodObject<{
|
|
9
10
|
assetIds: z.ZodArray<z.ZodString>;
|
|
10
11
|
}, z.core.$strip>;
|
|
@@ -383,7 +384,7 @@ export declare const agentToolSchemas: {
|
|
|
383
384
|
};
|
|
384
385
|
export type AgentToolName = keyof typeof agentToolSchemas;
|
|
385
386
|
export declare const agentToolDefinitions: {
|
|
386
|
-
name: "get_transcripts" | "find_transcript_moment" | "read_chat_history" | "search_tasks" | "search_notes" | "list_chats" | "list_root_contents" | "read_thread" | "read_recent" | "search_workspace" | "list_agents" | "search_files" | "list_folder_contents" | "list_todos" | "list_notes" | "list_folders" | "read_asset" | "download_file" | "upload_file" | "send_messages" | "react_to_message" | "read_note" | "create_note" | "update_note" | "create_tasks" | "update_tasks" | "delete_tasks" | "create_task" | "update_task" | "update_task_schedule" | "complete_task" | "delegate_agent";
|
|
387
|
+
name: "describe_access" | "get_transcripts" | "find_transcript_moment" | "read_chat_history" | "search_tasks" | "search_notes" | "list_chats" | "list_root_contents" | "read_thread" | "read_recent" | "search_workspace" | "list_agents" | "search_files" | "list_folder_contents" | "list_todos" | "list_notes" | "list_folders" | "read_asset" | "download_file" | "upload_file" | "send_messages" | "react_to_message" | "read_note" | "create_note" | "update_note" | "create_tasks" | "update_tasks" | "delete_tasks" | "create_task" | "update_task" | "update_task_schedule" | "complete_task" | "delegate_agent";
|
|
387
388
|
description: string;
|
|
388
389
|
inputSchema: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
|
|
389
390
|
items: z.ZodArray<z.ZodObject<{
|
|
@@ -436,7 +437,7 @@ export declare const agentToolDefinitions: {
|
|
|
436
437
|
}, z.core.$strip> | z.ZodObject<{
|
|
437
438
|
query: z.ZodString;
|
|
438
439
|
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
439
|
-
}, z.core.$strip> | z.ZodObject<{
|
|
440
|
+
}, z.core.$strip> | z.ZodObject<{}, z.core.$strip> | z.ZodObject<{
|
|
440
441
|
assetIds: z.ZodArray<z.ZodString>;
|
|
441
442
|
}, z.core.$strip> | z.ZodObject<{
|
|
442
443
|
assetId: z.ZodString;
|
package/dist/src/agent-tools.js
CHANGED
|
@@ -4,6 +4,7 @@ import { delegationEffect, delegationToolSchema, delegationToolDescription, exec
|
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { requestHostToolApproval } from "./adapter.js";
|
|
7
|
+
import { ownerContentUploadWithoutApproval } from "./approval-policy.js";
|
|
7
8
|
import { markNonOwnerContent } from "./content-provenance.js";
|
|
8
9
|
import { approvalStreamLabel, capabilityForContextTool, contextReadIsWithinGrant, contextToolApprovalBody, contextToolDescription, contextToolEffect, contextToolNames, contextToolSchemas, executeContextTool, } from "./context-tools.js";
|
|
9
10
|
import { capabilityForFileTool, createdByRunUpload, executeFileTool, fileToolDescription, fileToolEffect, fileToolNames, fileToolSchemas, } from "./file-tools.js";
|
|
@@ -92,7 +93,7 @@ export async function authorizeAgentToolApproval(context, agentDisplayName, name
|
|
|
92
93
|
else {
|
|
93
94
|
effectSummary = agentToolEffect(name, input, context);
|
|
94
95
|
}
|
|
95
|
-
const ownerOnlyUpload = name === "upload_file" &&
|
|
96
|
+
const ownerOnlyUpload = name === "upload_file" && ownerContentUploadWithoutApproval(context.trust.containsNonOwnerContent, context.scope.canCreateFiles);
|
|
96
97
|
const createdUpload = name === "upload_file" && !ownerOnlyUpload && typeof input.localPath === "string"
|
|
97
98
|
? await createdByRunUpload(input.localPath, workspaceRoot, context.runStartedAt)
|
|
98
99
|
: undefined;
|
|
@@ -182,6 +183,7 @@ export const toolResultProvenance = {
|
|
|
182
183
|
update_note: "third_party",
|
|
183
184
|
download_file: "checked",
|
|
184
185
|
upload_file: "owner",
|
|
186
|
+
describe_access: "owner",
|
|
185
187
|
get_transcripts: "checked",
|
|
186
188
|
find_transcript_moment: "checked",
|
|
187
189
|
read_chat_history: "checked",
|
|
@@ -1,5 +1,37 @@
|
|
|
1
|
-
import type { HostToolRequest } from "./adapter.js";
|
|
1
|
+
import type { AgentAdapterKind, HostToolRequest } from "./adapter.js";
|
|
2
|
+
import type { ContextAccessSummary } from "./protocol.js";
|
|
2
3
|
export type ApprovalFence = "sandbox" | "none";
|
|
4
|
+
export declare function ownerContentUploadWithoutApproval(containsNonOwnerContent: boolean, canCreateFiles: boolean): boolean;
|
|
5
|
+
export declare function showrunnerApprovalPolicySummary(grants: ContextAccessSummary["grantedActions"], containsNonOwnerContent: boolean): {
|
|
6
|
+
withoutAsking: {
|
|
7
|
+
reply: boolean;
|
|
8
|
+
react: boolean;
|
|
9
|
+
uploadFiles: boolean;
|
|
10
|
+
createTasks: boolean;
|
|
11
|
+
manageTasks: boolean;
|
|
12
|
+
createNotes: boolean;
|
|
13
|
+
delegate: boolean;
|
|
14
|
+
askQuestions: boolean;
|
|
15
|
+
};
|
|
16
|
+
requiresApproval: {
|
|
17
|
+
reply: boolean;
|
|
18
|
+
react: boolean;
|
|
19
|
+
uploadFiles: boolean;
|
|
20
|
+
createTasks: boolean;
|
|
21
|
+
manageTasks: boolean;
|
|
22
|
+
createNotes: boolean;
|
|
23
|
+
delegate: boolean;
|
|
24
|
+
askQuestions: boolean;
|
|
25
|
+
};
|
|
26
|
+
uploadProvenance: string;
|
|
27
|
+
};
|
|
28
|
+
export declare function approvalPolicySummary(containsNonOwnerContent: boolean, rememberApprovals: boolean, providerKind: AgentAdapterKind): {
|
|
29
|
+
localFileReadScope: string;
|
|
30
|
+
withoutAsking: string[];
|
|
31
|
+
asksBeforeUse: string[];
|
|
32
|
+
alwaysAsksThisRun: string[];
|
|
33
|
+
rememberedApprovalsCanApply: boolean;
|
|
34
|
+
};
|
|
3
35
|
export declare const destructiveCommands: ReadonlySet<string>;
|
|
4
36
|
export declare function cardlessByRule(input: {
|
|
5
37
|
request: HostToolRequest;
|
|
@@ -3,6 +3,50 @@ import path from "node:path";
|
|
|
3
3
|
import { commandName, isWithin } from "./command-boundaries.js";
|
|
4
4
|
import { commandReadsExternalContent } from "./content-provenance.js";
|
|
5
5
|
import { containsCredentialAccess, isVersionCheck, tokenize } from "./host-tool-risk.js";
|
|
6
|
+
export function ownerContentUploadWithoutApproval(containsNonOwnerContent, canCreateFiles) {
|
|
7
|
+
return !containsNonOwnerContent && canCreateFiles;
|
|
8
|
+
}
|
|
9
|
+
export function showrunnerApprovalPolicySummary(grants, containsNonOwnerContent) {
|
|
10
|
+
const uploadFiles = ownerContentUploadWithoutApproval(containsNonOwnerContent, grants.uploadFiles);
|
|
11
|
+
return {
|
|
12
|
+
withoutAsking: {
|
|
13
|
+
reply: grants.reply, react: grants.react, uploadFiles,
|
|
14
|
+
createTasks: false, manageTasks: false, createNotes: false, delegate: false,
|
|
15
|
+
askQuestions: grants.askQuestions,
|
|
16
|
+
},
|
|
17
|
+
requiresApproval: {
|
|
18
|
+
reply: false, react: false, uploadFiles: !uploadFiles,
|
|
19
|
+
createTasks: true, manageTasks: true, createNotes: true, delegate: true,
|
|
20
|
+
askQuestions: !grants.askQuestions,
|
|
21
|
+
},
|
|
22
|
+
uploadProvenance: grants.uploadFiles
|
|
23
|
+
? "Verified files created by this run can be uploaded without asking; other uploads follow the policy above."
|
|
24
|
+
: "File uploads require approval to grant access, including files created by this run.",
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export function approvalPolicySummary(containsNonOwnerContent, rememberApprovals, providerKind) {
|
|
28
|
+
return {
|
|
29
|
+
localFileReadScope: providerKind === "claude"
|
|
30
|
+
? "Existing files in the working folder and files downloaded for this run, including credential files such as .env, can be read without asking even when the run contains non-owner content. Other runs' downloads, including searches spanning them, and reads outside this scope require approval."
|
|
31
|
+
: "Local file reads follow the provider's configured permissions; the connector does not grant unrestricted filesystem access.",
|
|
32
|
+
withoutAsking: [
|
|
33
|
+
providerKind === "claude" ? "read_files_in_working_folder_or_this_run_downloads" : "read_files_within_provider_permitted_scope",
|
|
34
|
+
...(providerKind === "claude" ? ["web_search"] : []),
|
|
35
|
+
"eligible_low_risk_read_only_commands",
|
|
36
|
+
...(containsNonOwnerContent ? [] : ["eligible_safe_workspace_edits", "eligible_safe_local_commands"]),
|
|
37
|
+
],
|
|
38
|
+
asksBeforeUse: [
|
|
39
|
+
...(providerKind === "claude" ? ["local_file_reads_outside_permitted_scope", "network_access_except_web_search"]
|
|
40
|
+
: ["network_access_requested_through_connector"]),
|
|
41
|
+
providerKind === "claude" ? "credential_access_except_permitted_file_reads" : "credential_access",
|
|
42
|
+
"connected_service_changes",
|
|
43
|
+
"destructive_or_protected_changes",
|
|
44
|
+
"changes_outside_the_working_folder",
|
|
45
|
+
],
|
|
46
|
+
alwaysAsksThisRun: containsNonOwnerContent ? ["local_file_changes", "shell_commands_except_eligible_low_risk_reads"] : [],
|
|
47
|
+
rememberedApprovalsCanApply: rememberApprovals && !containsNonOwnerContent,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
6
50
|
const protectedSegments = new Set([
|
|
7
51
|
".git", ".claude", ".codex", ".grok", ".opencode", ".gemini", ".cursor", ".vscode", ".husky", ".github", ".agents",
|
|
8
52
|
]);
|
package/dist/src/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TaskCreate, TaskUpdate, TaskVersion } from "./task-management-dtos.js";
|
|
2
2
|
import type { AgentTranscriptItem, AgentTranscriptTimingsItem } from "@showrunner/agent-contracts/agent-dtos";
|
|
3
3
|
import type { CreateSurfacePieceRequest } from "@showrunner/agent-contracts/agent-write-piece-dtos";
|
|
4
|
-
import type { ContextNoteSearch, ContextChats, ContextRootContents, ContextAgents, ContextFileSearch, ContextTodos, ContextNotes, ContextFolders, ContextFolderContents } from "./protocol.js";
|
|
4
|
+
import type { ContextNoteSearch, ContextChats, ContextRootContents, ContextAgents, ContextAccessSummary, ContextFileSearch, ContextTodos, ContextNotes, ContextFolders, ContextFolderContents } from "./protocol.js";
|
|
5
5
|
import * as signalR from "@microsoft/signalr";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { type WakeSource } from "./wake-monitor.js";
|
|
@@ -269,6 +269,7 @@ export declare class ExternalAgentClient {
|
|
|
269
269
|
limit?: number;
|
|
270
270
|
}): Promise<ContextPage>;
|
|
271
271
|
listAgents(invocationId: string, cursor?: string | null): Promise<ContextAgents>;
|
|
272
|
+
describeAccess(invocationId: string): Promise<ContextAccessSummary>;
|
|
272
273
|
listChats(invocationId: string, cursor?: string | null, limit?: number): Promise<ContextChats>;
|
|
273
274
|
listRootContents(invocationId: string, streamId?: string, cursor?: string | null): Promise<ContextRootContents>;
|
|
274
275
|
searchFiles(invocationId: string, query: string, cursor?: string | null): Promise<ContextFileSearch>;
|
package/dist/src/client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getTranscriptsResponseScheme, getTranscriptTimingsResponseScheme } from "@showrunner/agent-contracts/agent-dtos";
|
|
2
2
|
import { normalizeApiBaseUrl } from "./connector-scope.js";
|
|
3
|
-
import { contextNoteSearchSchema, contextChatsSchema, contextRootContentsSchema, contextAgentsSchema, contextFileSearchSchema, contextTodosSchema, contextNotesSchema, contextFoldersSchema, contextFolderContentsSchema } from "./protocol.js";
|
|
3
|
+
import { contextNoteSearchSchema, contextChatsSchema, contextRootContentsSchema, contextAgentsSchema, contextAccessSummarySchema, contextFileSearchSchema, contextTodosSchema, contextNotesSchema, contextFoldersSchema, contextFolderContentsSchema } from "./protocol.js";
|
|
4
4
|
import * as signalR from "@microsoft/signalr";
|
|
5
5
|
import WebSocket from "ws";
|
|
6
6
|
import { z } from "zod";
|
|
@@ -706,6 +706,22 @@ export class ExternalAgentClient {
|
|
|
706
706
|
}
|
|
707
707
|
return contextAgentsSchema.parse(await response.json());
|
|
708
708
|
}
|
|
709
|
+
async describeAccess(invocationId) {
|
|
710
|
+
const token = await this.accessToken();
|
|
711
|
+
const response = await this.#fetch(`${this.#apiBaseUrl}/api/external-agent-gateway/v1/invocations/${invocationId}/context/access`, {
|
|
712
|
+
method: "GET",
|
|
713
|
+
headers: {
|
|
714
|
+
Authorization: `Bearer ${token}`,
|
|
715
|
+
"X-Showrunner-Connector-Version": this.#connectorVersion,
|
|
716
|
+
"X-Showrunner-Protocol": `${protocolVersion.major}.${protocolVersion.minor}`,
|
|
717
|
+
},
|
|
718
|
+
signal: AbortSignal.timeout(30_000),
|
|
719
|
+
});
|
|
720
|
+
if (!response.ok) {
|
|
721
|
+
throw new ExternalAgentError(`http_${response.status}`, "Connector access summary failed.", response.status);
|
|
722
|
+
}
|
|
723
|
+
return contextAccessSummarySchema.parse(await response.json());
|
|
724
|
+
}
|
|
709
725
|
async listChats(invocationId, cursor, limit = 25) {
|
|
710
726
|
const params = new URLSearchParams();
|
|
711
727
|
if (cursor != null) {
|
|
@@ -257,6 +257,7 @@ export function createCloudServer(options) {
|
|
|
257
257
|
invocationId: event.invocation.id,
|
|
258
258
|
runStartedAt: new Date(now),
|
|
259
259
|
providerKind: "custom",
|
|
260
|
+
hostToolsManaged: false,
|
|
260
261
|
externalSessionId: null,
|
|
261
262
|
model: event.installation.model,
|
|
262
263
|
reasoningEffort: event.installation.reasoningEffort,
|
|
@@ -124,7 +124,7 @@ export declare const cloudToolDefinitions: {
|
|
|
124
124
|
}, z.core.$strip> | z.ZodObject<{
|
|
125
125
|
query: z.ZodString;
|
|
126
126
|
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
127
|
-
}, z.core.$strip> | z.ZodObject<{
|
|
127
|
+
}, z.core.$strip> | z.ZodObject<{}, z.core.$strip> | z.ZodObject<{
|
|
128
128
|
assetIds: z.ZodArray<z.ZodString>;
|
|
129
129
|
}, z.core.$strip> | z.ZodObject<{
|
|
130
130
|
assetId: z.ZodString;
|
|
@@ -474,7 +474,7 @@ export declare const cloudToolDefinitions: {
|
|
|
474
474
|
contentSchema?: z.core.JSONSchema.JSONSchema;
|
|
475
475
|
_prefault?: unknown;
|
|
476
476
|
};
|
|
477
|
-
name: "get_transcripts" | "find_transcript_moment" | "read_chat_history" | "search_tasks" | "search_notes" | "list_chats" | "list_root_contents" | "read_thread" | "read_recent" | "search_workspace" | "list_agents" | "search_files" | "list_folder_contents" | "list_todos" | "list_notes" | "list_folders" | "read_asset" | "download_file" | "upload_file" | "send_messages" | "react_to_message" | "read_note" | "create_note" | "update_note" | "create_tasks" | "update_tasks" | "delete_tasks" | "create_task" | "update_task" | "update_task_schedule" | "complete_task" | "delegate_agent";
|
|
477
|
+
name: "describe_access" | "get_transcripts" | "find_transcript_moment" | "read_chat_history" | "search_tasks" | "search_notes" | "list_chats" | "list_root_contents" | "read_thread" | "read_recent" | "search_workspace" | "list_agents" | "search_files" | "list_folder_contents" | "list_todos" | "list_notes" | "list_folders" | "read_asset" | "download_file" | "upload_file" | "send_messages" | "react_to_message" | "read_note" | "create_note" | "update_note" | "create_tasks" | "update_tasks" | "delete_tasks" | "create_task" | "update_task" | "update_task_schedule" | "complete_task" | "delegate_agent";
|
|
478
478
|
}[];
|
|
479
479
|
/**
|
|
480
480
|
* Serves the Showrunner tools to an agent running on someone else's computer, over MCP's
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { AgentInvocationContext, AgentStreamScope, HostToolCapability } from "./adapter.js";
|
|
3
3
|
export declare const contextToolSchemas: {
|
|
4
|
+
readonly describe_access: z.ZodObject<{}, z.core.$strip>;
|
|
4
5
|
readonly get_transcripts: z.ZodObject<{
|
|
5
6
|
assetIds: z.ZodArray<z.ZodString>;
|
|
6
7
|
}, z.core.$strip>;
|
|
@@ -5,6 +5,13 @@ import { z } from "zod";
|
|
|
5
5
|
import { ExternalAgentError } from "./client.js";
|
|
6
6
|
import { toolFailure, toolSuccess } from "./pieces.js";
|
|
7
7
|
import { assetIsOwnerContent, markNonOwnerContent, messagesAreOwnerContent } from "./content-provenance.js";
|
|
8
|
+
import { ExternalAgentAccessCallerType } from "./protocol.js";
|
|
9
|
+
import { approvalPolicySummary, showrunnerApprovalPolicySummary } from "./approval-policy.js";
|
|
10
|
+
const accessCallerNames = {
|
|
11
|
+
[ExternalAgentAccessCallerType.Owner]: "owner",
|
|
12
|
+
[ExternalAgentAccessCallerType.Teammate]: "teammate",
|
|
13
|
+
[ExternalAgentAccessCallerType.WorkspaceCaller]: "workspace_caller",
|
|
14
|
+
};
|
|
8
15
|
const uuidSchema = z.string().uuid();
|
|
9
16
|
const cursorSchema = z.string().min(1).nullable().optional().describe("nextCursor from a previous page. Omit for the first page.");
|
|
10
17
|
const limitSchema = z.number().int().min(1).max(100).optional().describe("How many messages to return, 1-100. Default 25. Keep it small and page rather than pulling everything.");
|
|
@@ -13,6 +20,7 @@ const contentSearchSchema = z.object({
|
|
|
13
20
|
cursor: cursorSchema,
|
|
14
21
|
});
|
|
15
22
|
export const contextToolSchemas = {
|
|
23
|
+
describe_access: z.object({}),
|
|
16
24
|
get_transcripts: getTranscriptsSchema,
|
|
17
25
|
find_transcript_moment: findTranscriptMomentSchema,
|
|
18
26
|
read_chat_history: z.object({
|
|
@@ -65,6 +73,7 @@ export function capabilityForContextTool(_name) {
|
|
|
65
73
|
}
|
|
66
74
|
export function contextToolDescription(name) {
|
|
67
75
|
switch (name) {
|
|
76
|
+
case "describe_access": return "Use this whenever someone asks what you can access or do in this chat. Returns the authoritative current read and action grants, which actions ask first, who can call you here, and Showrunner account connection names. Account connections do not grant this agent provider access. Provider-configured connections and MCP servers are not inventoried here. Answer in plain language. Never infer or reveal tokens, credentials, account IDs, configuration, or local paths.";
|
|
68
77
|
case "get_transcripts": return getTranscriptsDescription;
|
|
69
78
|
case "find_transcript_moment": return findTranscriptMomentDescription;
|
|
70
79
|
case "read_chat_history": return "Read a reachable chat or a specific message thread, newest first. Use chat IDs and root message IDs from discovery and search. Requires chat-message access; use read_thread when only the current thread is granted.";
|
|
@@ -97,6 +106,7 @@ export function contextToolDescription(name) {
|
|
|
97
106
|
}
|
|
98
107
|
export function contextToolEffect(name, input) {
|
|
99
108
|
switch (name) {
|
|
109
|
+
case "describe_access": return "Describe access in this conversation";
|
|
100
110
|
case "get_transcripts": return "Read media transcripts";
|
|
101
111
|
case "find_transcript_moment": return "Find a quoted moment in a recording";
|
|
102
112
|
case "search_tasks": return "Search reachable tasks";
|
|
@@ -128,6 +138,9 @@ export function contextToolEffect(name, input) {
|
|
|
128
138
|
* because tasks are not included in the messages the agent receives.
|
|
129
139
|
*/
|
|
130
140
|
export function contextReadIsWithinGrant(name, scope) {
|
|
141
|
+
if (name === "describe_access") {
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
131
144
|
if (scope.isAgentChat && name !== "list_todos" && name !== "search_files" && name !== "search_tasks" && name !== "search_notes") {
|
|
132
145
|
return true;
|
|
133
146
|
}
|
|
@@ -170,6 +183,7 @@ function contextReadAction(name, scope, input, invocationStreamId) {
|
|
|
170
183
|
return `read messages in other chats accessible from ${target}`;
|
|
171
184
|
}
|
|
172
185
|
switch (name) {
|
|
186
|
+
case "describe_access": return `describe its access in ${target}`;
|
|
173
187
|
case "get_transcripts":
|
|
174
188
|
case "find_transcript_moment": return `read transcripts accessible from ${target}`;
|
|
175
189
|
case "read_chat_history":
|
|
@@ -194,6 +208,32 @@ function contextReadAction(name, scope, input, invocationStreamId) {
|
|
|
194
208
|
}
|
|
195
209
|
export async function executeContextTool(context, name, untrusted) {
|
|
196
210
|
try {
|
|
211
|
+
if (name === "describe_access") {
|
|
212
|
+
contextToolSchemas.describe_access.parse(untrusted);
|
|
213
|
+
const summary = await context.client.describeAccess();
|
|
214
|
+
return toolSuccess({
|
|
215
|
+
...summary,
|
|
216
|
+
connectionScope: "Showrunner account connections only; these do not grant this agent provider access. Provider-configured connections and MCP servers are not inventoried here.",
|
|
217
|
+
...showrunnerApprovalPolicySummary({
|
|
218
|
+
reply: context.scope.canCreateMessages,
|
|
219
|
+
react: context.scope.canReact,
|
|
220
|
+
uploadFiles: context.scope.canCreateFiles,
|
|
221
|
+
createTasks: context.scope.canCreateToDos,
|
|
222
|
+
manageTasks: context.scope.canManageToDos,
|
|
223
|
+
createNotes: context.scope.canCreateNotes,
|
|
224
|
+
delegate: context.scope.canDelegate,
|
|
225
|
+
askQuestions: context.scope.canRequestInput,
|
|
226
|
+
}, context.trust.containsNonOwnerContent),
|
|
227
|
+
approvalScope: "Approval policy reflects this run's connector permissions. Current server grants are reported separately and checked on each server call.",
|
|
228
|
+
callers: {
|
|
229
|
+
...summary.callers,
|
|
230
|
+
currentCallerType: accessCallerNames[summary.callers.currentCallerType],
|
|
231
|
+
},
|
|
232
|
+
...(context.hostToolsManaged === false ? {} : {
|
|
233
|
+
localComputer: approvalPolicySummary(context.trust.containsNonOwnerContent, context.scope.rememberApprovals, context.providerKind),
|
|
234
|
+
}),
|
|
235
|
+
});
|
|
236
|
+
}
|
|
197
237
|
if (name === "get_transcripts") {
|
|
198
238
|
const input = getTranscriptsSchema.parse(untrusted);
|
|
199
239
|
const items = await context.client.getTranscripts(input.assetIds);
|
package/dist/src/protocol.d.ts
CHANGED
|
@@ -755,6 +755,39 @@ export declare const contextAgentsSchema: z.ZodObject<{
|
|
|
755
755
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
756
756
|
}, z.core.$strip>;
|
|
757
757
|
export type ContextAgents = z.infer<typeof contextAgentsSchema>;
|
|
758
|
+
export declare enum ExternalAgentAccessCallerType {
|
|
759
|
+
Owner = 0,
|
|
760
|
+
Teammate = 1,
|
|
761
|
+
WorkspaceCaller = 2
|
|
762
|
+
}
|
|
763
|
+
export declare const contextAccessSummarySchema: z.ZodObject<{
|
|
764
|
+
reads: z.ZodObject<{
|
|
765
|
+
thread: z.ZodBoolean;
|
|
766
|
+
chatHistory: z.ZodBoolean;
|
|
767
|
+
recentMessages: z.ZodBoolean;
|
|
768
|
+
notes: z.ZodBoolean;
|
|
769
|
+
tasks: z.ZodBoolean;
|
|
770
|
+
workspaceSearch: z.ZodBoolean;
|
|
771
|
+
files: z.ZodBoolean;
|
|
772
|
+
}, z.core.$strip>;
|
|
773
|
+
grantedActions: z.ZodObject<{
|
|
774
|
+
reply: z.ZodBoolean;
|
|
775
|
+
react: z.ZodBoolean;
|
|
776
|
+
uploadFiles: z.ZodBoolean;
|
|
777
|
+
createTasks: z.ZodBoolean;
|
|
778
|
+
manageTasks: z.ZodBoolean;
|
|
779
|
+
createNotes: z.ZodBoolean;
|
|
780
|
+
delegate: z.ZodBoolean;
|
|
781
|
+
askQuestions: z.ZodBoolean;
|
|
782
|
+
}, z.core.$strip>;
|
|
783
|
+
rememberApprovals: z.ZodBoolean;
|
|
784
|
+
callers: z.ZodObject<{
|
|
785
|
+
currentCallerType: z.ZodEnum<typeof ExternalAgentAccessCallerType>;
|
|
786
|
+
allowedTeammateCount: z.ZodNumber;
|
|
787
|
+
}, z.core.$strip>;
|
|
788
|
+
showrunnerAccountConnections: z.ZodArray<z.ZodString>;
|
|
789
|
+
}, z.core.$strip>;
|
|
790
|
+
export type ContextAccessSummary = z.infer<typeof contextAccessSummarySchema>;
|
|
758
791
|
export declare const contextChatsSchema: z.ZodObject<{
|
|
759
792
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
760
793
|
hasMore: z.ZodBoolean;
|
package/dist/src/protocol.js
CHANGED
|
@@ -452,6 +452,40 @@ export const contextAgentsSchema = z.object({
|
|
|
452
452
|
})).max(50),
|
|
453
453
|
nextCursor: z.string().nullable(),
|
|
454
454
|
});
|
|
455
|
+
export var ExternalAgentAccessCallerType;
|
|
456
|
+
(function (ExternalAgentAccessCallerType) {
|
|
457
|
+
ExternalAgentAccessCallerType[ExternalAgentAccessCallerType["Owner"] = 0] = "Owner";
|
|
458
|
+
ExternalAgentAccessCallerType[ExternalAgentAccessCallerType["Teammate"] = 1] = "Teammate";
|
|
459
|
+
ExternalAgentAccessCallerType[ExternalAgentAccessCallerType["WorkspaceCaller"] = 2] = "WorkspaceCaller";
|
|
460
|
+
})(ExternalAgentAccessCallerType || (ExternalAgentAccessCallerType = {}));
|
|
461
|
+
const contextActionAccessSchema = z.object({
|
|
462
|
+
reply: z.boolean(),
|
|
463
|
+
react: z.boolean(),
|
|
464
|
+
uploadFiles: z.boolean(),
|
|
465
|
+
createTasks: z.boolean(),
|
|
466
|
+
manageTasks: z.boolean(),
|
|
467
|
+
createNotes: z.boolean(),
|
|
468
|
+
delegate: z.boolean(),
|
|
469
|
+
askQuestions: z.boolean(),
|
|
470
|
+
});
|
|
471
|
+
export const contextAccessSummarySchema = z.object({
|
|
472
|
+
reads: z.object({
|
|
473
|
+
thread: z.boolean(),
|
|
474
|
+
chatHistory: z.boolean(),
|
|
475
|
+
recentMessages: z.boolean(),
|
|
476
|
+
notes: z.boolean(),
|
|
477
|
+
tasks: z.boolean(),
|
|
478
|
+
workspaceSearch: z.boolean(),
|
|
479
|
+
files: z.boolean(),
|
|
480
|
+
}),
|
|
481
|
+
grantedActions: contextActionAccessSchema,
|
|
482
|
+
rememberApprovals: z.boolean(),
|
|
483
|
+
callers: z.object({
|
|
484
|
+
currentCallerType: z.enum(ExternalAgentAccessCallerType),
|
|
485
|
+
allowedTeammateCount: z.number().int().nonnegative(),
|
|
486
|
+
}),
|
|
487
|
+
showrunnerAccountConnections: z.array(z.string()),
|
|
488
|
+
});
|
|
455
489
|
export const contextChatsSchema = agentStreamPageScheme.extend({
|
|
456
490
|
streams: z.array(agentStreamScheme.extend({ streamId: z.string().uuid() })).max(50),
|
|
457
491
|
});
|
|
@@ -18,6 +18,7 @@ export function showrunnerToolActivity(tool) {
|
|
|
18
18
|
case "read_asset":
|
|
19
19
|
case "download_file": return { type: "reading", label: "Reading a file" };
|
|
20
20
|
case "read_note": return { type: "reading", label: "Reading a note" };
|
|
21
|
+
case "describe_access": return { type: "reading", label: "Checking access" };
|
|
21
22
|
case "get_transcripts":
|
|
22
23
|
case "find_transcript_moment": return { type: "reading", label: "Reading a transcript" };
|
|
23
24
|
case "list_chats":
|