@opencow-ai/opencow-agent-sdk 0.4.19 → 0.4.20

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.
@@ -1,5 +1,8 @@
1
+ import { type ToolInputJSONSchema } from '../../../types/toolRuntime.js';
2
+ import type { Message as MessageType } from 'src/types/message.js';
1
3
  import { z } from 'zod/v4';
2
4
  import type { PermissionResult } from '../../../permissions/PermissionResult.js';
5
+ import type { AgentDefinition } from './loadAgentsDir.js';
3
6
  export declare const inputSchema: () => z.ZodObject<{
4
7
  name: z.ZodOptional<z.ZodString>;
5
8
  description: z.ZodString;
@@ -19,10 +22,8 @@ export declare const inputSchema: () => z.ZodObject<{
19
22
  }>>;
20
23
  team_name: z.ZodOptional<z.ZodString>;
21
24
  subagent_type: z.ZodOptional<z.ZodString>;
22
- isolation: z.ZodOptional<z.ZodEnum<{
23
- worktree: "worktree";
24
- }>>;
25
25
  }, z.core.$strip>;
26
+ type InputSchema = ReturnType<typeof inputSchema>;
26
27
  export declare const outputSchema: () => z.ZodUnion<readonly [z.ZodObject<{
27
28
  agentId: z.ZodString;
28
29
  agentType: z.ZodOptional<z.ZodString>;
@@ -72,7 +73,50 @@ export type RemoteLaunchedOutput = {
72
73
  };
73
74
  import type { AgentToolProgress, ShellProgress } from '../../../types/tools.js';
74
75
  export type Progress = AgentToolProgress | ShellProgress;
75
- export declare const AgentTool: Omit<Omit<import("../../../types/toolRuntime.js").ToolRuntime<any, any, any>, "isEnabled" | "isConcurrencySafe" | "isReadOnly" | "isDestructive" | "checkPermissions" | "toAutoClassifierInput" | "userFacingName"> & Partial<Pick<import("../../../types/toolRuntime.js").ToolRuntime<any, any, any>, "isEnabled" | "isConcurrencySafe" | "isReadOnly" | "isDestructive" | "checkPermissions" | "toAutoClassifierInput" | "userFacingName">>, "isEnabled" | "isConcurrencySafe" | "isReadOnly" | "isDestructive" | "checkPermissions" | "toAutoClassifierInput" | "userFacingName"> & {
76
+ export declare const AgentTool: {
77
+ inputSchema: InputSchema;
78
+ inputJSONSchema: ToolInputJSONSchema;
79
+ name: string;
80
+ description: (input: any, options: {
81
+ isNonInteractiveSession: boolean;
82
+ toolPermissionContext: import("../../../types/toolRuntime.js").ToolPermissionContext;
83
+ tools: import("../../../types/toolRuntime.js").ToolRuntimes;
84
+ }) => Promise<string>;
85
+ prompt: (options: {
86
+ getToolPermissionContext: () => Promise<import("../../../types/toolRuntime.js").ToolPermissionContext>;
87
+ tools: import("../../../types/toolRuntime.js").ToolRuntimes;
88
+ agents: AgentDefinition[];
89
+ allowedAgentTypes?: string[];
90
+ }) => Promise<string>;
91
+ strict?: boolean;
92
+ aliases?: string[];
93
+ searchHint?: string;
94
+ mcpInfo?: {
95
+ serverName: string;
96
+ toolName: string;
97
+ };
98
+ isMcp?: boolean;
99
+ isLsp?: boolean;
100
+ shouldDefer?: boolean;
101
+ alwaysLoad?: boolean;
102
+ outputSchema?: z.ZodType<unknown>;
103
+ call: (args: any, context: import("../../../types/toolRuntime.js").ToolRuntimeContext, canUseTool: import("../../../types/toolRuntime.js").CanUseToolFn, parentMessage: MessageType, onProgress?: import("../../../types/toolRuntime.js").ToolCallProgress<any>) => Promise<import("../../../types/toolRuntime.js").ToolResult<any>>;
104
+ validateInput?: (input: any, context: import("../../../types/toolRuntime.js").ToolRuntimeContext) => Promise<import("../../../types/toolRuntime.js").ValidationResult>;
105
+ backfillObservableInput?: (input: Record<string, unknown>) => void;
106
+ inputsEquivalent?: (a: any, b: any) => boolean;
107
+ getPath?: (input: any) => string;
108
+ preparePermissionMatcher?: (input: any) => Promise<(pattern: string) => boolean>;
109
+ isOpenWorld?: (input: any) => boolean;
110
+ requiresUserInteraction?: () => boolean;
111
+ isSearchOrReadCommand?: (input: any) => {
112
+ isSearch: boolean;
113
+ isRead: boolean;
114
+ isList?: boolean;
115
+ };
116
+ interruptBehavior?: () => "cancel" | "block";
117
+ maxResultSizeChars: number;
118
+ mapToolResultToToolResultBlockParam: (content: any, toolUseID: string) => import("../../../session/canonical/types.js").CanonicalToolResultBlockParam;
119
+ extractSearchText?: (out: any) => string;
76
120
  isEnabled: () => boolean;
77
121
  isConcurrencySafe: (_input?: unknown) => boolean;
78
122
  isReadOnly: (_input?: unknown) => boolean;
@@ -83,3 +127,4 @@ export declare const AgentTool: Omit<Omit<import("../../../types/toolRuntime.js"
83
127
  toAutoClassifierInput: (_input?: unknown) => string;
84
128
  userFacingName: (_input?: unknown) => string;
85
129
  };
130
+ export {};
@@ -0,0 +1,7 @@
1
+ type AssistantMessageLike = {
2
+ message?: {
3
+ content?: unknown;
4
+ };
5
+ };
6
+ export declare function findEarlierDuplicateAgentToolUse(assistantMessage: AssistantMessageLike | undefined, currentToolUseId: string | undefined): string | undefined;
7
+ export {};
@@ -0,0 +1,36 @@
1
+ import { z } from 'zod/v4';
2
+ export declare const baseInputSchema: () => z.ZodObject<{
3
+ description: z.ZodString;
4
+ prompt: z.ZodString;
5
+ subagent_type: z.ZodOptional<z.ZodString>;
6
+ model: z.ZodOptional<z.ZodEnum<{
7
+ haiku: "haiku";
8
+ sonnet: "sonnet";
9
+ opus: "opus";
10
+ }>>;
11
+ run_in_background: z.ZodOptional<z.ZodBoolean>;
12
+ }, z.core.$strip>;
13
+ export declare function buildAgentInputSchema(options: {
14
+ worktreeIsolationAvailable: boolean;
15
+ includeCwd: boolean;
16
+ includeRunInBackground: boolean;
17
+ }): z.ZodObject<{
18
+ name: z.ZodOptional<z.ZodString>;
19
+ description: z.ZodString;
20
+ mode: z.ZodOptional<z.ZodEnum<{
21
+ default: "default";
22
+ acceptEdits: "acceptEdits";
23
+ bypassPermissions: "bypassPermissions";
24
+ plan: "plan";
25
+ dontAsk: "dontAsk";
26
+ auto: "auto";
27
+ }>>;
28
+ prompt: z.ZodString;
29
+ model: z.ZodOptional<z.ZodEnum<{
30
+ haiku: "haiku";
31
+ sonnet: "sonnet";
32
+ opus: "opus";
33
+ }>>;
34
+ team_name: z.ZodOptional<z.ZodString>;
35
+ subagent_type: z.ZodOptional<z.ZodString>;
36
+ }, z.core.$strip>;
@@ -0,0 +1,4 @@
1
+ import type { WorktreeUnavailableReason } from '../../worktreeAvailability.js';
2
+ export declare const WORKTREE_ISOLATION_SCHEMA_DESCRIPTION = "Isolation mode. Set \"worktree\" only when the user explicitly requests worktree isolation. It requires a Git repository with a resolvable HEAD commit or a configured WorktreeCreate hook; omit it for ordinary tasks, including read-only research.";
3
+ export declare const WORKTREE_ISOLATION_USAGE_GUIDANCE = "Only set `isolation: \"worktree\"` when the user explicitly requests worktree isolation. Omit it for ordinary tasks, including read-only research. Worktree isolation requires a Git repository with a resolvable HEAD commit or a configured WorktreeCreate hook.";
4
+ export declare function getWorktreeIsolationUnavailableMessage(reason: WorktreeUnavailableReason): string;
@@ -86,6 +86,16 @@ export declare function createAgentWorktree(slug: string): Promise<{
86
86
  gitRoot?: string;
87
87
  hookBased?: boolean;
88
88
  }>;
89
+ /**
90
+ * Whether AgentTool can safely advertise worktree isolation for the current
91
+ * query. Hook-based worktrees do not require Git; the built-in path requires
92
+ * both a repository and a resolvable base commit.
93
+ */
94
+ export declare function isAgentWorktreeIsolationAvailable(options?: {
95
+ cwd?: string;
96
+ hasCreateHook?: boolean;
97
+ gitAvailabilityCache?: Map<string, boolean>;
98
+ }): boolean;
89
99
  /**
90
100
  * Remove a worktree created by createAgentWorktree.
91
101
  * For git-based worktrees, removes the worktree directory and deletes the temporary branch.
@@ -0,0 +1,20 @@
1
+ export type WorktreeUnavailableReason = 'not_git_repository' | 'unborn_head' | 'git_unavailable';
2
+ export type GitWorktreeAvailability = {
3
+ available: true;
4
+ gitRoot: string;
5
+ headCommit: string;
6
+ } | {
7
+ available: false;
8
+ reason: WorktreeUnavailableReason;
9
+ };
10
+ export declare class WorktreeUnavailableError extends Error {
11
+ readonly reason: WorktreeUnavailableReason;
12
+ constructor(reason: WorktreeUnavailableReason);
13
+ }
14
+ /** Resolve Git worktree prerequisites using Git itself as the authority. */
15
+ export declare function resolveGitWorktreeAvailability(cwd: string, gitExecutable?: string): GitWorktreeAvailability;
16
+ /**
17
+ * Check the built-in Git worktree prerequisites without creating anything.
18
+ * An optional caller-owned cache keeps lifecycle and invalidation explicit.
19
+ */
20
+ export declare function isGitWorktreeIsolationAvailable(cwd: string, gitExecutable?: string, cache?: Map<string, boolean>): boolean;