@borgee/agents-host 0.2.84 → 0.2.94

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 (53) hide show
  1. package/README.md +1 -1
  2. package/dist/agents-host.js +15 -5
  3. package/dist/background-runs.d.ts +2 -1
  4. package/dist/background-runs.js +48 -17
  5. package/dist/chat/chat-control-plane.d.ts +1 -0
  6. package/dist/chat/sdk-chat-control-plane.d.ts +3 -0
  7. package/dist/chat/sdk-chat-control-plane.js +15 -0
  8. package/dist/plugin-sdk.js +136 -20
  9. package/dist/plugin-sdk.js.map +3 -3
  10. package/dist/providers/claude/adapter.d.ts +1 -0
  11. package/dist/providers/claude/adapter.js +31 -3
  12. package/dist/providers/claude/background-run-observer.d.ts +32 -0
  13. package/dist/providers/claude/background-run-observer.js +381 -0
  14. package/dist/providers/claude/cli-client.d.ts +12 -0
  15. package/dist/providers/claude/cli-client.js +449 -69
  16. package/dist/providers/claude/foreground-handoff.d.ts +4 -0
  17. package/dist/providers/claude/foreground-handoff.js +45 -0
  18. package/dist/providers/claude/task-cancellation-protocol.d.ts +14 -0
  19. package/dist/providers/claude/task-cancellation-protocol.js +21 -0
  20. package/dist/providers/copilot/activity-metadata.d.ts +3 -0
  21. package/dist/providers/copilot/activity-metadata.js +19 -0
  22. package/dist/providers/copilot/cli-client.js +5 -0
  23. package/dist/providers/provider-adapter.d.ts +8 -0
  24. package/dist/providers/provider-adapter.js +4 -0
  25. package/dist/types.d.ts +8 -0
  26. package/dist/vendor/claude-agent-acp/LICENSE +191 -0
  27. package/dist/vendor/claude-agent-acp/NOTICE +8 -0
  28. package/dist/vendor/claude-agent-acp/dist/acp-agent.d.ts +1017 -0
  29. package/dist/vendor/claude-agent-acp/dist/acp-agent.d.ts.map +1 -0
  30. package/dist/vendor/claude-agent-acp/dist/acp-agent.js +6305 -0
  31. package/dist/vendor/claude-agent-acp/dist/borgee-foreground-handoff-bridge.js +322 -0
  32. package/dist/vendor/claude-agent-acp/dist/borgee-task-cancellation-bridge.js +101 -0
  33. package/dist/vendor/claude-agent-acp/dist/borgee-task-lifecycle-bridge.js +58 -0
  34. package/dist/vendor/claude-agent-acp/dist/elicitation.d.ts +130 -0
  35. package/dist/vendor/claude-agent-acp/dist/elicitation.d.ts.map +1 -0
  36. package/dist/vendor/claude-agent-acp/dist/elicitation.js +304 -0
  37. package/dist/vendor/claude-agent-acp/dist/index.d.ts +3 -0
  38. package/dist/vendor/claude-agent-acp/dist/index.d.ts.map +1 -0
  39. package/dist/vendor/claude-agent-acp/dist/index.js +75 -0
  40. package/dist/vendor/claude-agent-acp/dist/lib.d.ts +6 -0
  41. package/dist/vendor/claude-agent-acp/dist/lib.d.ts.map +1 -0
  42. package/dist/vendor/claude-agent-acp/dist/lib.js +5 -0
  43. package/dist/vendor/claude-agent-acp/dist/settings.d.ts +68 -0
  44. package/dist/vendor/claude-agent-acp/dist/settings.d.ts.map +1 -0
  45. package/dist/vendor/claude-agent-acp/dist/settings.js +185 -0
  46. package/dist/vendor/claude-agent-acp/dist/tools.d.ts +102 -0
  47. package/dist/vendor/claude-agent-acp/dist/tools.d.ts.map +1 -0
  48. package/dist/vendor/claude-agent-acp/dist/tools.js +1000 -0
  49. package/dist/vendor/claude-agent-acp/dist/utils.d.ts +16 -0
  50. package/dist/vendor/claude-agent-acp/dist/utils.d.ts.map +1 -0
  51. package/dist/vendor/claude-agent-acp/dist/utils.js +81 -0
  52. package/dist/vendor/claude-agent-acp/package.json +85 -0
  53. package/package.json +14 -10
@@ -0,0 +1,102 @@
1
+ import { PlanEntry, ToolCallContent, ToolCallLocation, ToolKind } from "@agentclientprotocol/sdk";
2
+ import { HookCallback } from "@anthropic-ai/claude-agent-sdk";
3
+ import { TaskCreateInput, TaskCreateOutput, TaskUpdateInput } from "@anthropic-ai/claude-agent-sdk/sdk-tools.js";
4
+ import { ToolResultBlockParam, WebSearchToolResultBlockParam } from "@anthropic-ai/sdk/resources";
5
+ import { BetaBashCodeExecutionToolResultBlockParam, BetaCodeExecutionToolResultBlockParam, BetaRequestMCPToolResultBlockParam, BetaTextEditorCodeExecutionToolResultBlockParam, BetaToolResultBlockParam, BetaToolSearchToolResultBlockParam, BetaWebFetchToolResultBlockParam, BetaWebSearchToolResultBlockParam } from "@anthropic-ai/sdk/resources/beta.mjs";
6
+ interface ToolInfo {
7
+ title: string;
8
+ kind: ToolKind;
9
+ content: ToolCallContent[];
10
+ locations?: ToolCallLocation[];
11
+ }
12
+ interface ToolUpdate {
13
+ title?: string;
14
+ content?: ToolCallContent[];
15
+ locations?: ToolCallLocation[];
16
+ _meta?: {
17
+ terminal_info?: {
18
+ terminal_id: string;
19
+ };
20
+ terminal_output?: {
21
+ terminal_id: string;
22
+ data: string;
23
+ };
24
+ terminal_exit?: {
25
+ terminal_id: string;
26
+ exit_code: number;
27
+ signal: string | null;
28
+ };
29
+ };
30
+ }
31
+ /**
32
+ * Convert an absolute file path to a project-relative path for display.
33
+ * Returns the original path if it's outside the project directory or if no cwd is provided.
34
+ */
35
+ export declare function toDisplayPath(filePath: string, cwd?: string): string;
36
+ export declare function toolInfoFromToolUse(toolUse: any, supportsTerminalOutput?: boolean, cwd?: string): ToolInfo;
37
+ export declare function toolUpdateFromToolResult(toolResult: ToolResultBlockParam | BetaToolResultBlockParam | BetaWebSearchToolResultBlockParam | BetaWebFetchToolResultBlockParam | WebSearchToolResultBlockParam | BetaCodeExecutionToolResultBlockParam | BetaBashCodeExecutionToolResultBlockParam | BetaTextEditorCodeExecutionToolResultBlockParam | BetaRequestMCPToolResultBlockParam | BetaToolSearchToolResultBlockParam, toolUse: any | undefined, supportsTerminalOutput?: boolean, toolUseResult?: unknown): ToolUpdate;
38
+ export type ClaudePlanEntry = {
39
+ content: string;
40
+ status: "pending" | "in_progress" | "completed";
41
+ activeForm: string;
42
+ };
43
+ export declare function planEntries(input: {
44
+ todos: ClaudePlanEntry[];
45
+ } | undefined): PlanEntry[];
46
+ /**
47
+ * Per-session task list accumulated from Task* tool calls (TaskCreate /
48
+ * TaskUpdate). The headless/SDK session emits these as incremental tool
49
+ * calls keyed by task ID, replacing the snapshot-style TodoWrite tool.
50
+ * Iteration order is insertion order (Map semantics), matching the order
51
+ * tasks are created.
52
+ */
53
+ export type TaskEntry = {
54
+ subject: string;
55
+ status: "pending" | "in_progress" | "completed";
56
+ activeForm?: string;
57
+ description?: string;
58
+ };
59
+ export type TaskState = Map<string, TaskEntry>;
60
+ /**
61
+ * Best-effort parse of a TaskCreate tool_result content into the structured
62
+ * TaskCreateOutput. The SDK delivers tool outputs either as a string or as
63
+ * an array of TextBlockParam-like blocks containing JSON text; try both.
64
+ */
65
+ export declare function parseTaskCreateOutput(content: unknown): TaskCreateOutput | undefined;
66
+ export declare function applyTaskCreate(state: TaskState, input: TaskCreateInput | undefined, output: TaskCreateOutput | undefined): void;
67
+ export declare function applyTaskUpdate(state: TaskState, input: TaskUpdateInput | undefined): void;
68
+ export declare function taskStateToPlanEntries(state: TaskState): PlanEntry[];
69
+ export declare function markdownEscape(text: string): string;
70
+ /**
71
+ * Builds diff ToolUpdate content from the structured toolResponse provided by
72
+ * the PostToolUse hook for diff-producing tools (Edit, Write). Unlike parsing
73
+ * the plain unified diff string, this uses the pre-parsed structuredPatch
74
+ * which supports multiple replacement sites (replaceAll) and always includes
75
+ * context lines for better readability.
76
+ */
77
+ export declare function toolUpdateFromDiffToolResponse(toolResponse: unknown): {
78
+ content?: ToolCallContent[];
79
+ locations?: ToolCallLocation[];
80
+ };
81
+ export declare const registerHookCallback: (toolUseID: string, { onPostToolUseHook, }: {
82
+ onPostToolUseHook?: (toolUseID: string, toolInput: unknown, toolResponse: unknown) => Promise<void>;
83
+ }) => void;
84
+ export declare const createPostToolUseHook: (options?: {
85
+ onEnterPlanMode?: () => Promise<void>;
86
+ }) => HookCallback;
87
+ /**
88
+ * Hook callback for `TaskCreated` / `TaskCompleted` events. The SDK fires
89
+ * these for both user-facing TaskCreate tool calls and subagent task
90
+ * creation, giving us `task_id` + `task_subject` without having to parse
91
+ * tool_result payloads.
92
+ *
93
+ * Populating `taskState` from the hook means a later `TaskUpdate` (which
94
+ * typically only carries `taskId` + `status`) finds an existing entry with
95
+ * a real subject, instead of synthesizing a placeholder with empty content.
96
+ */
97
+ export declare const createTaskHook: (options: {
98
+ taskState: TaskState;
99
+ onChange?: () => Promise<void>;
100
+ }) => HookCallback;
101
+ export {};
102
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACT,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAaL,eAAe,EACf,gBAAgB,EAChB,eAAe,EAKhB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAGL,oBAAoB,EAEpB,6BAA6B,EAE9B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,yCAAyC,EAGzC,qCAAqC,EAGrC,kCAAkC,EAGlC,+CAA+C,EAI/C,wBAAwB,EACxB,kCAAkC,EAIlC,gCAAgC,EAEhC,iCAAiC,EAClC,MAAM,sCAAsC,CAAC;AA2B9C,UAAU,QAAQ;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAChC;AAED,UAAU,UAAU;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,KAAK,CAAC,EAAE;QACN,aAAa,CAAC,EAAE;YACd,WAAW,EAAE,MAAM,CAAC;SACrB,CAAC;QACF,eAAe,CAAC,EAAE;YAChB,WAA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