@opencow-ai/opencow-agent-sdk 0.4.6 → 0.4.8

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.
Files changed (37) hide show
  1. package/dist/Tool.d.ts +1 -0
  2. package/dist/capabilities/SdkTool.d.ts +8 -0
  3. package/dist/capabilities/mcp/types.d.ts +1 -1
  4. package/dist/capabilities/tools/AgentTool/agentMerge.d.ts +8 -0
  5. package/dist/capabilities/tools/AgentTool/builtInAgents.d.ts +15 -0
  6. package/dist/capabilities/tools/AgentTool/runAgent.d.ts +13 -2
  7. package/dist/capabilities/tools/ToolSearchTool/ToolSearchTool.d.ts +1 -1
  8. package/dist/cli.mjs +914 -567
  9. package/dist/client.d.ts +10 -0
  10. package/dist/client.js +863 -399
  11. package/dist/constants/envVars.d.ts +1 -0
  12. package/dist/constants/tools.d.ts +1 -1
  13. package/dist/controller/compact/autoCompact.d.ts +17 -1
  14. package/dist/controller/compact/reactiveCompact.d.ts +52 -0
  15. package/dist/controller/hooks.d.ts +17 -2
  16. package/dist/controller/loop.d.ts +2 -5
  17. package/dist/controller/query/deps.d.ts +2 -1
  18. package/dist/controller/toolSearch.d.ts +20 -0
  19. package/dist/entrypoints/sdk/controlSchemas.d.ts +74 -1
  20. package/dist/entrypoints/sdk/coreSchemas.d.ts +19 -1
  21. package/dist/entrypoints/sdk/runtimeTypes.d.ts +41 -0
  22. package/dist/lib/envDynamic.d.ts +1 -1
  23. package/dist/permissions/permissions.d.ts +15 -0
  24. package/dist/providers/anthropic/teleport/api.d.ts +1 -1
  25. package/dist/providers/codex/shim.d.ts +8 -0
  26. package/dist/providers/openai/shim.d.ts +19 -12
  27. package/dist/providers/provider.d.ts +2 -5
  28. package/dist/providers/shared/clientFactory.d.ts +2 -5
  29. package/dist/providers/shared/logging.d.ts +2 -2
  30. package/dist/providers/shared/model/providers.d.ts +5 -0
  31. package/dist/providers/shared/routing.d.ts +37 -6
  32. package/dist/providers/shared/usage.d.ts +11 -0
  33. package/dist/query.d.ts +3 -0
  34. package/dist/sdk.js +863 -399
  35. package/dist/session/backgroundAbortRegistry.d.ts +23 -0
  36. package/dist/types/toolRuntime.d.ts +14 -5
  37. package/package.json +3 -3
package/dist/Tool.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { CanonicalToolResultBlockParam as ToolResultBlockParam } from './session/canonical/index.js';
2
2
  import type { z } from 'zod/v4';
3
3
  import type { CanUseToolFn } from './types/toolRuntime.js';
4
+ import type { SetToolJSXFn } from './types/toolUI.js';
4
5
  export type { ToolRuntime, ToolRuntimes, ToolRuntimeContext, CanUseToolFn as CanUseToolFnRuntime, } from './types/toolRuntime.js';
5
6
  export { toolMatchesName as toolMatchesNameRuntime, findToolRuntimeByName, } from './types/toolRuntime.js';
6
7
  export type { ToolUI } from './types/toolUI.js';
@@ -34,4 +34,12 @@ export interface SdkTool {
34
34
  * use this to schedule parallel calls.
35
35
  */
36
36
  readonly isConcurrencySafe?: boolean;
37
+ /**
38
+ * Optional: defer this tool behind ToolSearch. Deferred tools are NOT
39
+ * serialized into every model request — only their name is announced;
40
+ * the model loads the full schema on demand via ToolSearchTool. Use for
41
+ * large dynamic tool pools (e.g. cloud-tool catalogs). Defaults to
42
+ * false: inline tools are loaded upfront, preserving existing behavior.
43
+ */
44
+ readonly shouldDefer?: boolean;
37
45
  }
@@ -5,10 +5,10 @@ export declare const ConfigScopeSchema: () => z.ZodEnum<{
5
5
  user: "user";
6
6
  project: "project";
7
7
  local: "local";
8
- managed: "managed";
9
8
  dynamic: "dynamic";
10
9
  enterprise: "enterprise";
11
10
  claudeai: "claudeai";
11
+ managed: "managed";
12
12
  }>;
13
13
  export type ConfigScope = z.infer<ReturnType<typeof ConfigScopeSchema>>;
14
14
  export declare const TransportSchema: () => z.ZodEnum<{
@@ -0,0 +1,8 @@
1
+ import type { AgentDefinition } from './loadAgentsDir.js';
2
+ /**
3
+ * Merge two agent lists, deduping by `agentType`. `override` entries win over
4
+ * `base` entries of the same `agentType`; a built-in's slot/order is preserved
5
+ * when overridden. Used to combine SDK built-in agents (`base`) with
6
+ * host-provided `Options.agents` (`override`).
7
+ */
8
+ export declare function mergeAgentsByType(base: AgentDefinition[], override: AgentDefinition[]): AgentDefinition[];
@@ -1,3 +1,18 @@
1
1
  import type { AgentDefinition } from './loadAgentsDir.js';
2
2
  export declare function areExplorePlanAgentsEnabled(): boolean;
3
3
  export declare function getBuiltInAgents(): AgentDefinition[];
4
+ /**
5
+ * Resolve the active agent set for the SDK programmatic path.
6
+ *
7
+ * The CLI merges built-in agents through `loadAgentsDir`, but the SDK runtime
8
+ * path (`sdkRuntime` → `QueryEngine`) used `Options.agents` verbatim. A host
9
+ * that passes no agents therefore ended up with an EMPTY `activeAgents` list,
10
+ * so every `subagent_type` — including the universal `general-purpose` — failed
11
+ * with "Agent type X not found. Available agents:" and no subagent could run.
12
+ *
13
+ * Merge the built-ins back in (deduped by `agentType`, host definitions taking
14
+ * precedence over a built-in of the same type). `getBuiltInAgents()` already
15
+ * honors `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`, so a host wanting a blank
16
+ * slate keeps that opt-out.
17
+ */
18
+ export declare function resolveSdkAgents(hostAgents: AgentDefinition[]): AgentDefinition[];
@@ -2,13 +2,13 @@ import type { QuerySource } from '../../../constants/querySource.js';
2
2
  import type { CanUseToolFn } from '../../../types/canUseTool.js';
3
3
  import type { ToolRuntimes, ToolRuntimeContext } from '../../../types/toolRuntime.js';
4
4
  import type { AgentId } from '../../../types/ids.js';
5
- import type { Message } from '../../../types/message.js';
5
+ import type { AssistantMessage, Message } from '../../../types/message.js';
6
6
  import { type CacheSafeParams } from '../../../session/forkedAgent.js';
7
7
  import type { ModelAlias } from '../../../providers/shared/model/aliases.js';
8
8
  import { type SystemPrompt } from '../../../session/systemPromptType.js';
9
9
  import type { ContentReplacementState } from '../../../controller/toolResultStorage.js';
10
10
  import { type AgentDefinition } from './loadAgentsDir.js';
11
- export declare function runAgent({ agentDefinition, promptMessages, toolUseContext, canUseTool, isAsync, canShowPermissionPrompts, forkContextMessages, querySource, override, model, maxTurns, preserveToolUseResults, availableTools, allowedTools, onCacheSafeParams, contentReplacementState, useExactTools, worktreePath, description, transcriptSubdir, onQueryProgress, agentName, }: {
11
+ export declare function runAgent({ agentDefinition, promptMessages, toolUseContext, canUseTool, isAsync, canShowPermissionPrompts, forkContextMessages, querySource, override, model, maxTurns, preserveToolUseResults, availableTools, allowedTools, onCacheSafeParams, contentReplacementState, useExactTools, worktreePath, description, transcriptSubdir, onQueryProgress, onPartialAssistant, agentName, }: {
12
12
  agentDefinition: AgentDefinition;
13
13
  promptMessages: Message[];
14
14
  toolUseContext: ToolRuntimeContext;
@@ -71,6 +71,17 @@ export declare function runAgent({ agentDefinition, promptMessages, toolUseConte
71
71
  * during long single-block streams (e.g. thinking) where no assistant
72
72
  * message is yielded for >60s. */
73
73
  onQueryProgress?: () => void;
74
+ /** Optional callback fired with a GROWING single-block assistant message as
75
+ * the sub-agent's text streams token-by-token (content_block_delta /
76
+ * text_delta accumulated per content-block index, keyed to the message_start
77
+ * id). The consumer (AgentTool) forwards it via the existing agent_progress
78
+ * onProgress channel so the host renders the sub-conversation token-by-token
79
+ * instead of block-at-once. Side-channel only: these partials are NOT yielded
80
+ * and NOT recorded to the sidechain transcript — the authoritative whole
81
+ * messages still flow through the normal yield path (graceful degradation:
82
+ * if the provider emits no text_delta, rendering falls back to block
83
+ * granularity). Wired only for foreground sub-agents today. */
84
+ onPartialAssistant?: (message: AssistantMessage) => void;
74
85
  /** Agent name (team member name) for routing resolution */
75
86
  agentName?: string;
76
87
  }): AsyncGenerator<Message, void>;
@@ -33,7 +33,7 @@ export declare const ToolSearchTool: Omit<{
33
33
  renderToolUseMessage(): any;
34
34
  userFacingName: () => string;
35
35
  /**
36
- * Returns a tool_result with tool_reference blocks.
36
+ * Native wire: returns a tool_result with tool_reference blocks.
37
37
  * This format works on 1P/Foundry. Bedrock/Vertex may not support
38
38
  * client-side tool_reference expansion yet.
39
39
  */