@borgee/agents-host 0.2.73 → 0.2.84
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/README.md +17 -30
- package/dist/agents-host-supervisor.d.ts +1 -0
- package/dist/agents-host-supervisor.js +3 -1
- package/dist/agents-host.d.ts +6 -4
- package/dist/agents-host.js +117 -16
- package/dist/background-runs.d.ts +23 -0
- package/dist/background-runs.js +153 -0
- package/dist/chat/chat-control-plane.d.ts +6 -1
- package/dist/chat/sdk-chat-control-plane.d.ts +4 -2
- package/dist/chat/sdk-chat-control-plane.js +7 -0
- package/dist/context/claude-file-brief.js +3 -3
- package/dist/context/injection.d.ts +18 -12
- package/dist/context/injection.js +53 -53
- package/dist/context/prompt.js +10 -10
- package/dist/context/resolved-working-folder.d.ts +3 -0
- package/dist/context/resolved-working-folder.js +106 -0
- package/dist/context/turn-preparation.js +1 -1
- package/dist/local-config.d.ts +7 -0
- package/dist/local-config.js +158 -12
- package/dist/managed-daemon.js +42 -35
- package/dist/plugin-sdk.js +179 -9
- package/dist/plugin-sdk.js.map +3 -3
- package/dist/policy/authorization-audit.d.ts +1 -1
- package/dist/policy/copilot-permission.d.ts +9 -0
- package/dist/policy/copilot-permission.js +120 -1
- package/dist/progress-to-activity.d.ts +1 -1
- package/dist/progress-to-activity.js +1 -0
- package/dist/providers/claude/adapter.d.ts +1 -1
- package/dist/providers/claude/adapter.js +7 -0
- package/dist/providers/claude/cli-client.js +4 -3
- package/dist/providers/codex/adapter.d.ts +1 -1
- package/dist/providers/codex/adapter.js +7 -0
- package/dist/providers/codex/cli-client.js +8 -7
- package/dist/providers/codex/project-doc.js +6 -6
- package/dist/providers/copilot/adapter.d.ts +6 -2
- package/dist/providers/copilot/adapter.js +27 -1
- package/dist/providers/copilot/cli-client.d.ts +37 -10
- package/dist/providers/copilot/cli-client.js +751 -122
- package/dist/providers/copilot/sdk-session.d.ts +149 -0
- package/dist/providers/copilot/sdk-session.js +981 -0
- package/dist/providers/create-provider.js +33 -0
- package/dist/providers/provider-adapter.d.ts +16 -1
- package/dist/providers/provider-adapter.js +13 -0
- package/dist/types.d.ts +32 -11
- package/package.json +3 -2
- package/skills/borgee-agent/references/task-properties.md +3 -3
- package/skills/borgee-agent/scripts/borgee-agent.mjs +1 -1
- package/skills/borgee-agent/scripts/borgee-agent.py +1 -1
- package/dist/context/resolved-workspace.d.ts +0 -3
- package/dist/context/resolved-workspace.js +0 -106
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import type { ActiveSession, ContentBlock } from '@agentclientprotocol/sdk';
|
|
2
|
+
import { type MessageOptions, type PermissionHandler, type ResumeSessionConfig, type SessionConfig, type SessionEventHandler } from '@github/copilot-sdk';
|
|
3
|
+
import type { ProviderBackgroundRunProgress } from '../../types.js';
|
|
4
|
+
type CopilotSessionUpdate = Awaited<ReturnType<ActiveSession['nextUpdate']>>;
|
|
5
|
+
type CopilotPromptResponse = Awaited<ReturnType<ActiveSession['prompt']>>;
|
|
6
|
+
interface CopilotSdkTaskInfo {
|
|
7
|
+
id: string;
|
|
8
|
+
type: 'agent' | 'shell';
|
|
9
|
+
status: 'running' | 'idle' | 'completed' | 'failed' | 'cancelled';
|
|
10
|
+
description?: string;
|
|
11
|
+
startedAt?: string;
|
|
12
|
+
completedAt?: string;
|
|
13
|
+
activeStartedAt?: string;
|
|
14
|
+
idleSince?: string;
|
|
15
|
+
executionMode?: 'sync' | 'background';
|
|
16
|
+
error?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface CopilotBackgroundExecutionState {
|
|
19
|
+
startedAt: number;
|
|
20
|
+
terminal: boolean;
|
|
21
|
+
waiting: boolean;
|
|
22
|
+
activeStartedAt?: number;
|
|
23
|
+
terminalAt?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface CopilotSdkSessionLike {
|
|
26
|
+
readonly sessionId: string;
|
|
27
|
+
readonly rpc: {
|
|
28
|
+
interruptMainTurn(params: {
|
|
29
|
+
flushQueued?: boolean;
|
|
30
|
+
}): Promise<{
|
|
31
|
+
interrupted: boolean;
|
|
32
|
+
}>;
|
|
33
|
+
cancelAllBackgroundAgents(): Promise<number>;
|
|
34
|
+
tasks: {
|
|
35
|
+
list(): Promise<{
|
|
36
|
+
tasks: CopilotSdkTaskInfo[];
|
|
37
|
+
}>;
|
|
38
|
+
cancel(params: {
|
|
39
|
+
id: string;
|
|
40
|
+
}): Promise<{
|
|
41
|
+
cancelled: boolean;
|
|
42
|
+
}>;
|
|
43
|
+
};
|
|
44
|
+
shutdown(params: {
|
|
45
|
+
type?: 'routine' | 'error';
|
|
46
|
+
reason?: string;
|
|
47
|
+
}): Promise<void>;
|
|
48
|
+
};
|
|
49
|
+
on(handler: SessionEventHandler): () => void;
|
|
50
|
+
send(options: MessageOptions): Promise<string>;
|
|
51
|
+
disconnect(): Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
export interface CopilotSdkClientLike {
|
|
54
|
+
start(): Promise<void>;
|
|
55
|
+
stop(): Promise<Error[]>;
|
|
56
|
+
forceStop(): Promise<void>;
|
|
57
|
+
createSession(config: SessionConfig): Promise<CopilotSdkSessionLike>;
|
|
58
|
+
resumeSession(sessionId: string, config: ResumeSessionConfig): Promise<CopilotSdkSessionLike>;
|
|
59
|
+
}
|
|
60
|
+
export type CopilotSdkClientFactory = (command: string, cwd: string, debug: boolean) => CopilotSdkClientLike;
|
|
61
|
+
export declare function resolveCopilotCommandPath(command: string, cwd?: string, env?: NodeJS.ProcessEnv): string;
|
|
62
|
+
export declare function createCopilotSdkRuntimeConnection(commandPath: string): import("@github/copilot-sdk").StdioRuntimeConnection;
|
|
63
|
+
export declare const createCopilotSdkClient: CopilotSdkClientFactory;
|
|
64
|
+
export declare function createCopilotSdkSessionConfig(cwd: string, onPermissionRequest: PermissionHandler): SessionConfig;
|
|
65
|
+
export interface CopilotAutonomousReply {
|
|
66
|
+
eventId: string;
|
|
67
|
+
text: string;
|
|
68
|
+
}
|
|
69
|
+
export declare function toCopilotBackgroundRunProgress(task: CopilotSdkTaskInfo, explicitWait?: {
|
|
70
|
+
reason: string;
|
|
71
|
+
}, executionStartedAt?: number): ProviderBackgroundRunProgress | undefined;
|
|
72
|
+
export declare class CopilotSdkSessionAdapter {
|
|
73
|
+
private readonly session;
|
|
74
|
+
private readonly onBackgroundRun;
|
|
75
|
+
private readonly onBackgroundAgentPresenceChanged;
|
|
76
|
+
private readonly onBackgroundRunError;
|
|
77
|
+
private readonly onAutonomousReply;
|
|
78
|
+
private readonly onAutonomousTurnPresenceChanged;
|
|
79
|
+
private readonly onBackgroundTaskExecutionsChanged;
|
|
80
|
+
readonly transport = "sdk";
|
|
81
|
+
private readonly pendingUpdates;
|
|
82
|
+
private readonly updateWaiters;
|
|
83
|
+
private readonly unsubscribe;
|
|
84
|
+
private activeTurn?;
|
|
85
|
+
private currentRootTurnId?;
|
|
86
|
+
private lastRootTurnId?;
|
|
87
|
+
private backgroundAgentsActive;
|
|
88
|
+
private backgroundTaskRefresh;
|
|
89
|
+
private backgroundTaskRefreshFailures;
|
|
90
|
+
private backgroundTaskRefreshRetry?;
|
|
91
|
+
private readonly reportedBackgroundTasks;
|
|
92
|
+
private readonly autonomousTurns;
|
|
93
|
+
private readonly autonomousTurnIdByRuntimeTurnId;
|
|
94
|
+
private readonly autonomousTurnIdByInteractionId;
|
|
95
|
+
private readonly backgroundCompletionSignals;
|
|
96
|
+
private backgroundCompletionSignalExpiry?;
|
|
97
|
+
private autonomousTurnPending;
|
|
98
|
+
private readonly backgroundTaskExecutions;
|
|
99
|
+
private backgroundTaskExecutionsDirty;
|
|
100
|
+
private readonly backgroundWaits;
|
|
101
|
+
private lastSyntheticExecutionStartedAt;
|
|
102
|
+
private closePromise?;
|
|
103
|
+
constructor(session: CopilotSdkSessionLike, onBackgroundRun: (run: ProviderBackgroundRunProgress) => void, onBackgroundAgentPresenceChanged: (active: boolean) => void, onBackgroundRunError: (error: Error) => void, onAutonomousReply: (reply: CopilotAutonomousReply) => void, onAutonomousTurnPresenceChanged: (active: boolean) => void, initialBackgroundTaskExecutions?: Readonly<Record<string, CopilotBackgroundExecutionState>>, onBackgroundTaskExecutionsChanged?: (executions: Readonly<Record<string, CopilotBackgroundExecutionState>>) => Promise<void>);
|
|
104
|
+
get sessionId(): string;
|
|
105
|
+
prompt(input: string | ContentBlock[]): Promise<CopilotPromptResponse>;
|
|
106
|
+
nextUpdate(): Promise<CopilotSessionUpdate>;
|
|
107
|
+
interruptMainTurn(): Promise<boolean>;
|
|
108
|
+
cancelAllBackgroundWork(): Promise<boolean>;
|
|
109
|
+
cancelBackgroundRun(providerRunId: string): Promise<boolean>;
|
|
110
|
+
hasBackgroundAgents(): Promise<boolean>;
|
|
111
|
+
backgroundTaskExecutionState(): Readonly<Record<string, CopilotBackgroundExecutionState>>;
|
|
112
|
+
reconcileBackgroundTasks(): Promise<void>;
|
|
113
|
+
close(reason?: Error): Promise<void>;
|
|
114
|
+
private emitUpdate;
|
|
115
|
+
private queueBackgroundTaskRefresh;
|
|
116
|
+
/**
|
|
117
|
+
* Completion signals and their autonomous root turns are separate SDK event
|
|
118
|
+
* streams and may arrive in either order. A short-lived signal confirms an
|
|
119
|
+
* otherwise unowned root turn; only that root turn's assistant messages are
|
|
120
|
+
* eligible for delivery outside the foreground prompt.
|
|
121
|
+
*/
|
|
122
|
+
private noteBackgroundCompletion;
|
|
123
|
+
private isAutonomousCompletionMessage;
|
|
124
|
+
private beginAutonomousTurn;
|
|
125
|
+
private createAutonomousTurn;
|
|
126
|
+
private bindAutonomousTurn;
|
|
127
|
+
private findAutonomousTurn;
|
|
128
|
+
private consumeBackgroundCompletionSignal;
|
|
129
|
+
private pruneBackgroundCompletionSignals;
|
|
130
|
+
private scheduleBackgroundCompletionSignalExpiry;
|
|
131
|
+
private refreshAutonomousTurnPresence;
|
|
132
|
+
private resolveBackgroundExecutionStartedAt;
|
|
133
|
+
private handleEvent;
|
|
134
|
+
private handleAutonomousTurnEvent;
|
|
135
|
+
private finishAutonomousTurn;
|
|
136
|
+
private discardAutonomousTurn;
|
|
137
|
+
private handleBackgroundAgentEvent;
|
|
138
|
+
private recordBackgroundWait;
|
|
139
|
+
private resolveBackgroundWait;
|
|
140
|
+
private backgroundWaitFor;
|
|
141
|
+
private handleOwnedTurnEvent;
|
|
142
|
+
private interruptAttachedTurn;
|
|
143
|
+
private finishActiveTurn;
|
|
144
|
+
private resolveEventTurnId;
|
|
145
|
+
private noteTurnBoundary;
|
|
146
|
+
private isPromptUserMessage;
|
|
147
|
+
private readUserMessageTurnId;
|
|
148
|
+
}
|
|
149
|
+
export {};
|