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

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.
@@ -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>;