@borgee/agents-host 0.2.1 → 0.2.26
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 +184 -21
- package/dist/agents-host-supervisor.d.ts +7 -5
- package/dist/agents-host-supervisor.js +24 -4
- package/dist/agents-host.d.ts +89 -15
- package/dist/agents-host.js +2099 -142
- package/dist/chat/chat-control-plane.d.ts +14 -3
- package/dist/chat/sdk-chat-control-plane.d.ts +16 -4
- package/dist/chat/sdk-chat-control-plane.js +69 -9
- package/dist/cli-args.d.ts +46 -5
- package/dist/cli-args.js +313 -32
- package/dist/cli.d.ts +9 -0
- package/dist/cli.js +112 -5
- package/dist/compatibility-gates.d.ts +35 -0
- package/dist/compatibility-gates.js +127 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.js +23 -5
- package/dist/connections-state-store.d.ts +81 -0
- package/dist/connections-state-store.js +228 -0
- package/dist/context/injection.d.ts +109 -0
- package/dist/context/injection.js +350 -0
- package/dist/context/prompt.d.ts +4 -1
- package/dist/context/prompt.js +170 -1
- package/dist/context/turn-preparation.d.ts +9 -0
- package/dist/context/turn-preparation.js +106 -0
- package/dist/debug.d.ts +44 -0
- package/dist/debug.js +135 -0
- package/dist/gateway/localhost-gateway.d.ts +52 -0
- package/dist/gateway/localhost-gateway.js +857 -0
- package/dist/index.js +7 -5
- package/dist/local-config.d.ts +4 -1
- package/dist/local-config.js +24 -7
- package/dist/managed-daemon-log.d.ts +34 -0
- package/dist/managed-daemon-log.js +261 -0
- package/dist/managed-daemon.d.ts +220 -0
- package/dist/managed-daemon.js +1601 -0
- package/dist/policy/authorization-audit.d.ts +63 -0
- package/dist/policy/authorization-audit.js +94 -0
- package/dist/policy/copilot-permission.d.ts +15 -0
- package/dist/policy/copilot-permission.js +193 -0
- package/dist/policy/gateway-authorization.d.ts +42 -0
- package/dist/policy/gateway-authorization.js +162 -0
- package/dist/providers/awaiting-user.d.ts +12 -0
- package/dist/providers/awaiting-user.js +151 -0
- package/dist/providers/claude/adapter.d.ts +3 -1
- package/dist/providers/claude/adapter.js +8 -12
- package/dist/providers/claude/cli-client.d.ts +12 -5
- package/dist/providers/claude/cli-client.js +184 -37
- package/dist/providers/claude/session-store.d.ts +24 -0
- package/dist/providers/claude/session-store.js +65 -12
- package/dist/providers/codex/adapter.d.ts +11 -0
- package/dist/providers/codex/adapter.js +19 -0
- package/dist/providers/codex/cli-client.d.ts +103 -0
- package/dist/providers/codex/cli-client.js +1133 -0
- package/dist/providers/codex/project-doc.d.ts +3 -0
- package/dist/providers/codex/project-doc.js +66 -0
- package/dist/providers/codex/session-store.d.ts +38 -0
- package/dist/providers/codex/session-store.js +150 -0
- package/dist/providers/copilot/adapter.d.ts +3 -1
- package/dist/providers/copilot/adapter.js +8 -12
- package/dist/providers/copilot/cli-client.d.ts +20 -2
- package/dist/providers/copilot/cli-client.js +251 -71
- package/dist/providers/copilot/session-store.d.ts +24 -0
- package/dist/providers/copilot/session-store.js +65 -12
- package/dist/providers/create-provider.d.ts +11 -2
- package/dist/providers/create-provider.js +131 -12
- package/dist/run.d.ts +1 -0
- package/dist/run.js +5 -2
- package/dist/state-paths.d.ts +13 -1
- package/dist/state-paths.js +84 -3
- package/dist/task-thread-resolution.d.ts +10 -0
- package/dist/task-thread-resolution.js +48 -0
- package/dist/types.d.ts +174 -1
- package/dist/visible-mentions.d.ts +3 -0
- package/dist/visible-mentions.js +15 -0
- package/package.json +19 -17
- package/skills/borgee-agent/SKILL.md +33 -0
- package/skills/borgee-agent/borgee-agent.mjs +473 -0
- package/skills/borgee-agent/borgee-agent.py +409 -0
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export type ProviderKind = 'claude' | 'copilot';
|
|
1
|
+
export type ProviderKind = 'claude' | 'codex' | 'copilot';
|
|
2
2
|
export interface ProviderCommandConfig {
|
|
3
3
|
claudeCommand: string;
|
|
4
4
|
claudeArgs: string[];
|
|
5
|
+
codexCommand: string;
|
|
6
|
+
codexArgs: string[];
|
|
5
7
|
copilotCommand: string;
|
|
6
8
|
copilotArgs: string[];
|
|
7
9
|
copilotSessionTtlMinutes: number;
|
|
@@ -83,6 +85,7 @@ export interface LocalConfigGenerateResult {
|
|
|
83
85
|
}
|
|
84
86
|
export interface ChannelMessageEvent {
|
|
85
87
|
type?: string;
|
|
88
|
+
message_type?: string;
|
|
86
89
|
channel_id: string;
|
|
87
90
|
channel_type?: string;
|
|
88
91
|
message_id?: string;
|
|
@@ -99,19 +102,189 @@ export interface MeResponseUser {
|
|
|
99
102
|
display_name?: string;
|
|
100
103
|
role?: string;
|
|
101
104
|
}
|
|
105
|
+
export interface DirectoryUser {
|
|
106
|
+
id: string;
|
|
107
|
+
display_name?: string;
|
|
108
|
+
kind: 'user' | 'agent';
|
|
109
|
+
}
|
|
110
|
+
export interface ChannelHistoryEntry {
|
|
111
|
+
id: string;
|
|
112
|
+
channelId: string;
|
|
113
|
+
authorId: string;
|
|
114
|
+
body: string;
|
|
115
|
+
contentType?: string;
|
|
116
|
+
type?: string;
|
|
117
|
+
replyToId?: string;
|
|
118
|
+
createdAt: number;
|
|
119
|
+
editedAt?: number;
|
|
120
|
+
}
|
|
121
|
+
export interface ReadChannelHistoryInput {
|
|
122
|
+
channelId: string;
|
|
123
|
+
before?: number;
|
|
124
|
+
after?: number;
|
|
125
|
+
limit: number;
|
|
126
|
+
}
|
|
127
|
+
export interface ChannelSummary {
|
|
128
|
+
id: string;
|
|
129
|
+
name: string;
|
|
130
|
+
kind?: string;
|
|
131
|
+
}
|
|
132
|
+
export interface CollaborationDraftSnapshot {
|
|
133
|
+
draftId: string;
|
|
134
|
+
channelId: string;
|
|
135
|
+
turnExecutionId: string;
|
|
136
|
+
replyToId?: string;
|
|
137
|
+
body: string;
|
|
138
|
+
status: 'streaming' | 'finalized';
|
|
139
|
+
updatedAt: number;
|
|
140
|
+
finalMessageId?: string;
|
|
141
|
+
}
|
|
142
|
+
export type ProviderCollaborationTurnMode = 'ordinary' | 'silent-kickoff' | 'protocol-managed';
|
|
143
|
+
export interface ProviderCollaborationContext {
|
|
144
|
+
enabled: boolean;
|
|
145
|
+
turnExecutionId?: string;
|
|
146
|
+
sendRoutesAllowed?: boolean;
|
|
147
|
+
turnMode?: ProviderCollaborationTurnMode;
|
|
148
|
+
kickoff?: ProviderProtocolKickoffContext;
|
|
149
|
+
protocol?: ProviderProtocolContext;
|
|
150
|
+
grounding?: ProviderTurnGroundingContext;
|
|
151
|
+
}
|
|
102
152
|
export interface ProviderInput {
|
|
103
153
|
agentName: string;
|
|
104
154
|
provider: ProviderKind;
|
|
105
155
|
channelId: string;
|
|
106
156
|
incomingAuthorId: string;
|
|
107
157
|
incomingContent: string;
|
|
158
|
+
incomingEventKind?: string;
|
|
159
|
+
incomingMessageType?: string;
|
|
160
|
+
collaboration?: ProviderCollaborationContext;
|
|
161
|
+
}
|
|
162
|
+
export interface ProviderProtocolContext {
|
|
163
|
+
anchorMessageId: string;
|
|
164
|
+
anchorSummary: string;
|
|
165
|
+
issuerId: string;
|
|
166
|
+
role: 'issuer' | 'intermediate' | 'final';
|
|
167
|
+
targetPeerId: string;
|
|
168
|
+
turnIndex: number;
|
|
169
|
+
maxTurnCount: number;
|
|
170
|
+
}
|
|
171
|
+
export interface ProviderProtocolKickoffContext {
|
|
172
|
+
anchorMessageId: string;
|
|
173
|
+
participantIds: [string, string];
|
|
174
|
+
issuerId: string;
|
|
175
|
+
}
|
|
176
|
+
export interface ProviderTurnIdentity {
|
|
177
|
+
id: string;
|
|
178
|
+
displayName?: string;
|
|
179
|
+
kind: 'human' | 'agent' | 'unknown';
|
|
108
180
|
}
|
|
181
|
+
export interface ProviderTurnGroundingContext {
|
|
182
|
+
self: ProviderTurnIdentity;
|
|
183
|
+
incomingAuthor: ProviderTurnIdentity;
|
|
184
|
+
peer?: ProviderTurnIdentity;
|
|
185
|
+
participants?: ProviderTurnIdentity[];
|
|
186
|
+
hostRecognizedKickoffCandidate?: boolean;
|
|
187
|
+
}
|
|
188
|
+
export interface SkillRuntimeBootstrapMetadata {
|
|
189
|
+
skillDirectoryPath: string;
|
|
190
|
+
skillMarkdownPath: string;
|
|
191
|
+
nodeCliPath: string;
|
|
192
|
+
pythonCliPath: string;
|
|
193
|
+
}
|
|
194
|
+
export interface LocalhostGatewayBootstrapMetadata {
|
|
195
|
+
baseUrl: string;
|
|
196
|
+
collaboration?: {
|
|
197
|
+
enabled: true;
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
export interface TaskAssignmentThreadContext {
|
|
201
|
+
active: true;
|
|
202
|
+
currentTaskId?: string;
|
|
203
|
+
}
|
|
204
|
+
export interface TaskWorkspaceContext {
|
|
205
|
+
currentTaskId: string;
|
|
206
|
+
rootPath: string;
|
|
207
|
+
}
|
|
208
|
+
export interface PreparedPromptContext {
|
|
209
|
+
channelContextPayloadPath?: string;
|
|
210
|
+
gatewayAuthPath?: string;
|
|
211
|
+
collaborationTurnExecutionId?: string;
|
|
212
|
+
collaborationTurnMode?: ProviderCollaborationTurnMode;
|
|
213
|
+
kickoff?: ProviderProtocolKickoffContext;
|
|
214
|
+
protocol?: ProviderProtocolContext;
|
|
215
|
+
grounding?: ProviderTurnGroundingContext;
|
|
216
|
+
skillRuntime?: SkillRuntimeBootstrapMetadata;
|
|
217
|
+
localhostGateway?: LocalhostGatewayBootstrapMetadata;
|
|
218
|
+
taskAssignmentContext?: TaskAssignmentThreadContext;
|
|
219
|
+
taskWorkspace?: TaskWorkspaceContext;
|
|
220
|
+
}
|
|
221
|
+
export interface PreparedProviderSessionRouting {
|
|
222
|
+
key: string;
|
|
223
|
+
persistence: 'persistent' | 'ephemeral';
|
|
224
|
+
}
|
|
225
|
+
export interface PreparedProviderTurnInput {
|
|
226
|
+
channelId: string;
|
|
227
|
+
incomingEventKind?: string;
|
|
228
|
+
incomingMessageType?: string;
|
|
229
|
+
prompt: string;
|
|
230
|
+
promptContext?: PreparedPromptContext;
|
|
231
|
+
providerSessionRouting?: PreparedProviderSessionRouting;
|
|
232
|
+
}
|
|
233
|
+
export interface ProviderAwaitingUser {
|
|
234
|
+
question: string;
|
|
235
|
+
reason?: string;
|
|
236
|
+
}
|
|
237
|
+
export type ProviderTurnControl = {
|
|
238
|
+
kind: 'continue-to-peer';
|
|
239
|
+
} | {
|
|
240
|
+
kind: 'conclude-locally';
|
|
241
|
+
} | {
|
|
242
|
+
kind: 'start-protocol';
|
|
243
|
+
rounds: number;
|
|
244
|
+
} | ({
|
|
245
|
+
kind: 'awaiting-user';
|
|
246
|
+
} & ProviderAwaitingUser);
|
|
109
247
|
export interface ProviderReply {
|
|
110
248
|
text: string;
|
|
249
|
+
awaitingUser?: ProviderAwaitingUser;
|
|
250
|
+
control?: ProviderTurnControl;
|
|
251
|
+
controlMalformed?: boolean;
|
|
111
252
|
}
|
|
112
253
|
export interface PostedMessage {
|
|
113
254
|
messageId: string;
|
|
114
255
|
}
|
|
256
|
+
export interface PostMessageInput {
|
|
257
|
+
channelId: string;
|
|
258
|
+
body: string;
|
|
259
|
+
replyToId?: string;
|
|
260
|
+
}
|
|
261
|
+
export interface Task {
|
|
262
|
+
id: string;
|
|
263
|
+
channelId: string;
|
|
264
|
+
guildId: string;
|
|
265
|
+
seq?: number;
|
|
266
|
+
title: string;
|
|
267
|
+
description: string;
|
|
268
|
+
status: string;
|
|
269
|
+
assigneeId: string | null;
|
|
270
|
+
createdBy: string;
|
|
271
|
+
messageId: string | null;
|
|
272
|
+
threadId: string | null;
|
|
273
|
+
createdAt: number;
|
|
274
|
+
updatedAt: number;
|
|
275
|
+
}
|
|
276
|
+
export interface CreateTaskInput {
|
|
277
|
+
channelId: string;
|
|
278
|
+
title: string;
|
|
279
|
+
description?: string;
|
|
280
|
+
assigneeId?: string;
|
|
281
|
+
}
|
|
282
|
+
export interface UpdateTaskInput {
|
|
283
|
+
taskId: string;
|
|
284
|
+
status?: string;
|
|
285
|
+
assigneeId?: string;
|
|
286
|
+
title?: string;
|
|
287
|
+
}
|
|
115
288
|
export interface ProviderProgressUpdate {
|
|
116
289
|
text: string;
|
|
117
290
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function extractVisibleMentionIds(content) {
|
|
2
|
+
return [...content.matchAll(/<@([^>\s]+)>/gu)]
|
|
3
|
+
.map((match) => match[1]?.trim())
|
|
4
|
+
.filter((value) => Boolean(value));
|
|
5
|
+
}
|
|
6
|
+
export function hasVisibleMention(content, participantId) {
|
|
7
|
+
return extractVisibleMentionIds(content).includes(participantId);
|
|
8
|
+
}
|
|
9
|
+
export function appendVisibleMention(content, participantId) {
|
|
10
|
+
if (hasVisibleMention(content, participantId)) {
|
|
11
|
+
return content;
|
|
12
|
+
}
|
|
13
|
+
const separator = /\s$/u.test(content) ? '' : ' ';
|
|
14
|
+
return `${content}${separator}<@${participantId}>`;
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@borgee/agents-host",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.26",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
|
-
"description": "Minimal local agents host: connects
|
|
9
|
+
"description": "Minimal local agents host: connects local Claude/Codex/Copilot runtimes to a Borgee agent over @borgee/plugin-sdk",
|
|
10
10
|
"bin": {
|
|
11
|
-
"agents-host": "dist/cli.js"
|
|
11
|
+
"agents-host": "./dist/cli.js"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"dist",
|
|
15
|
+
"skills",
|
|
15
16
|
"README.md"
|
|
16
17
|
],
|
|
17
18
|
"repository": {
|
|
@@ -20,6 +21,20 @@
|
|
|
20
21
|
"directory": "packages/agents-host"
|
|
21
22
|
},
|
|
22
23
|
"license": "MIT",
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@agentclientprotocol/codex-acp": "1.1.7",
|
|
26
|
+
"@agentclientprotocol/sdk": "1.3.0",
|
|
27
|
+
"cross-spawn": "^7.0.6",
|
|
28
|
+
"yaml": "^2.8.1",
|
|
29
|
+
"@borgee/plugin-sdk": "0.2.4"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/cross-spawn": "^6.0.6",
|
|
33
|
+
"@types/node": "^24.3.0",
|
|
34
|
+
"tsx": "^4.20.5",
|
|
35
|
+
"typescript": "^5.9.3",
|
|
36
|
+
"vitest": "^4.1.5"
|
|
37
|
+
},
|
|
23
38
|
"scripts": {
|
|
24
39
|
"predev": "pnpm --filter @borgee/plugin-sdk build",
|
|
25
40
|
"dev": "tsx src/index.ts",
|
|
@@ -33,18 +48,5 @@
|
|
|
33
48
|
"pretest": "pnpm --filter @borgee/plugin-sdk build",
|
|
34
49
|
"test": "vitest run --testTimeout=10000",
|
|
35
50
|
"pretypecheck": "pnpm --filter @borgee/plugin-sdk build"
|
|
36
|
-
},
|
|
37
|
-
"dependencies": {
|
|
38
|
-
"@agentclientprotocol/sdk": "^1.2.1",
|
|
39
|
-
"@borgee/plugin-sdk": "0.1.4",
|
|
40
|
-
"cross-spawn": "^7.0.6",
|
|
41
|
-
"yaml": "^2.8.1"
|
|
42
|
-
},
|
|
43
|
-
"devDependencies": {
|
|
44
|
-
"@types/cross-spawn": "^6.0.6",
|
|
45
|
-
"@types/node": "^24.3.0",
|
|
46
|
-
"tsx": "^4.20.5",
|
|
47
|
-
"typescript": "^5.9.3",
|
|
48
|
-
"vitest": "^4.1.5"
|
|
49
51
|
}
|
|
50
|
-
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Borgee Agent Skill Bootstrap
|
|
2
|
+
|
|
3
|
+
This skill runtime surface stays read-only for final visible replies in this slice.
|
|
4
|
+
|
|
5
|
+
Use one of the packaged local CLIs to inspect the current channel bootstrap payload. When `localhost-gateway` is enabled together with `context-injection` and `skill-runtime`, the same CLIs can also call the loopback gateway using the persisted context payload.
|
|
6
|
+
|
|
7
|
+
- Node: `node ./borgee-agent.mjs --context /absolute/path/to/context.json --print-bootstrap`
|
|
8
|
+
- Python: `python3 ./borgee-agent.py --context /absolute/path/to/context.json --print-bootstrap`
|
|
9
|
+
- Node health: `node ./borgee-agent.mjs --context /absolute/path/to/context.json --auth-path /absolute/path/to/.localhost-gateway-auth.json --health`
|
|
10
|
+
- Node bootstrap: `node ./borgee-agent.mjs --context /absolute/path/to/context.json --auth-path /absolute/path/to/.localhost-gateway-auth.json --read-bootstrap`
|
|
11
|
+
- Node identity: `node ./borgee-agent.mjs --context /absolute/path/to/context.json --auth-path /absolute/path/to/.localhost-gateway-auth.json --get-me`
|
|
12
|
+
- Node history: `node ./borgee-agent.mjs --context /absolute/path/to/context.json --auth-path /absolute/path/to/.localhost-gateway-auth.json --read-history --limit 20`
|
|
13
|
+
- Node private draft snapshot: `node ./borgee-agent.mjs --context /absolute/path/to/context.json --auth-path /absolute/path/to/.localhost-gateway-auth.json --turn-execution-id turn-id --read-draft`
|
|
14
|
+
- Node users: `node ./borgee-agent.mjs --context /absolute/path/to/context.json --auth-path /absolute/path/to/.localhost-gateway-auth.json --list-users`
|
|
15
|
+
- Node auxiliary mention: `node ./borgee-agent.mjs --context /absolute/path/to/context.json --auth-path /absolute/path/to/.localhost-gateway-auth.json --turn-execution-id turn-id --send-mention user-id --body "Need review from <@user-id>"`
|
|
16
|
+
- Node auxiliary reply: `node ./borgee-agent.mjs --context /absolute/path/to/context.json --auth-path /absolute/path/to/.localhost-gateway-auth.json --turn-execution-id turn-id --send-message --body "Following up here" --reply-to message-id`
|
|
17
|
+
- Python health: `python3 ./borgee-agent.py --context /absolute/path/to/context.json --auth-path /absolute/path/to/.localhost-gateway-auth.json --health`
|
|
18
|
+
- Python bootstrap: `python3 ./borgee-agent.py --context /absolute/path/to/context.json --auth-path /absolute/path/to/.localhost-gateway-auth.json --read-bootstrap`
|
|
19
|
+
- Python identity: `python3 ./borgee-agent.py --context /absolute/path/to/context.json --auth-path /absolute/path/to/.localhost-gateway-auth.json --get-me`
|
|
20
|
+
- Python history: `python3 ./borgee-agent.py --context /absolute/path/to/context.json --auth-path /absolute/path/to/.localhost-gateway-auth.json --read-history --limit 20`
|
|
21
|
+
- Python private draft snapshot: `python3 ./borgee-agent.py --context /absolute/path/to/context.json --auth-path /absolute/path/to/.localhost-gateway-auth.json --turn-execution-id turn-id --read-draft`
|
|
22
|
+
- Python users: `python3 ./borgee-agent.py --context /absolute/path/to/context.json --auth-path /absolute/path/to/.localhost-gateway-auth.json --list-users`
|
|
23
|
+
- Python auxiliary mention: `python3 ./borgee-agent.py --context /absolute/path/to/context.json --auth-path /absolute/path/to/.localhost-gateway-auth.json --turn-execution-id turn-id --send-mention user-id --body "Need review from <@user-id>"`
|
|
24
|
+
- Python auxiliary reply: `python3 ./borgee-agent.py --context /absolute/path/to/context.json --auth-path /absolute/path/to/.localhost-gateway-auth.json --turn-execution-id turn-id --send-message --body "Following up here" --reply-to message-id`
|
|
25
|
+
|
|
26
|
+
When the injected `context.json` includes `taskAssignmentContext.active: true`, the same CLIs also expose the task-thread compatibility surface:
|
|
27
|
+
|
|
28
|
+
- In ordinary parent channels: `--create-task`, `--list-tasks`, `--get-task --task-id ...`, `--update-task --task-id ...`
|
|
29
|
+
- In task-assignment threads: `--get-task` and `--update-task` may omit `--task-id` and resolve the current thread task through the persisted `currentTaskId` or an agents-host local fallback; `--create-task` and `--list-tasks` stay disabled there and must be run from the parent channel
|
|
30
|
+
|
|
31
|
+
The private draft snapshot is read-only, collaboration-scoped, and separate from ordinary public channel messages.
|
|
32
|
+
Auxiliary sends are only for short targeted escalation, reply-thread nudges, or mentions. They must not be used for the main final answer body, which still belongs to AgentsHost.
|
|
33
|
+
Both CLIs are local-only, may only access the loopback gateway described above, and must not mutate files.
|