@borgee/agents-host 0.2.101 → 0.2.110
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 +77 -5
- package/dist/agents-host.d.ts +8 -0
- package/dist/agents-host.js +355 -23
- package/dist/catalog-worker.js +21 -0
- package/dist/catalog-worker.js.map +7 -0
- package/dist/chat/chat-control-plane.d.ts +7 -2
- package/dist/chat/normalized-input.d.ts +9 -0
- package/dist/chat/normalized-input.js +24 -0
- package/dist/chat/sdk-chat-control-plane.d.ts +18 -3
- package/dist/chat/sdk-chat-control-plane.js +44 -9
- package/dist/cli-args.d.ts +1 -1
- package/dist/cli-args.js +13 -4
- package/dist/config.d.ts +3 -1
- package/dist/config.js +25 -0
- package/dist/context/injection.d.ts +16 -0
- package/dist/context/injection.js +37 -21
- package/dist/context/prompt.d.ts +12 -0
- package/dist/context/prompt.js +25 -0
- package/dist/context/turn-preparation.d.ts +2 -1
- package/dist/context/turn-preparation.js +15 -0
- package/dist/gateway/localhost-gateway.js +33 -8
- package/dist/hosted-turn-content.js +3 -2
- package/dist/local-config.js +34 -1
- package/dist/managed-daemon.js +15 -0
- package/dist/native-environment.d.ts +2 -0
- package/dist/native-environment.js +9 -0
- package/dist/native-protocol-types/codec.d.ts +49 -0
- package/dist/native-protocol-types/commands.d.ts +71 -0
- package/dist/native-protocol-types/compatibility.d.ts +5 -0
- package/dist/native-protocol-types/cursor.d.ts +7 -0
- package/dist/native-protocol-types/envelope.d.ts +1105 -0
- package/dist/native-protocol-types/file-changes.d.ts +20 -0
- package/dist/native-protocol-types/history.d.ts +487 -0
- package/dist/native-protocol-types/index.d.ts +18 -0
- package/dist/native-protocol-types/interactions.d.ts +619 -0
- package/dist/native-protocol-types/messages.d.ts +2482 -0
- package/dist/native-protocol-types/public-validation.d.ts +10 -0
- package/dist/native-protocol-types/remote-host-uplink.d.ts +67 -0
- package/dist/native-protocol-types/resources.d.ts +126 -0
- package/dist/native-protocol-types/session-settings.d.ts +22 -0
- package/dist/native-protocol-types/snapshot.d.ts +575 -0
- package/dist/native-protocol-types/timeline.d.ts +1503 -0
- package/dist/native-protocol-types/tool-result.d.ts +26 -0
- package/dist/native-protocol-types/uplink.d.ts +56 -0
- package/dist/native-protocol-types/version.d.ts +5 -0
- package/dist/native-provider-types/commands.d.ts +51 -0
- package/dist/native-provider-types/control.d.ts +192 -0
- package/dist/native-provider-types/file-changes.d.ts +9 -0
- package/dist/native-provider-types/index.d.ts +8 -0
- package/dist/native-provider-types/interactions.d.ts +7 -0
- package/dist/native-provider-types/observation.d.ts +209 -0
- package/dist/native-provider-types/provider.d.ts +124 -0
- package/dist/native-provider-types/session-settings.d.ts +17 -0
- package/dist/native-provider-types/testing.d.ts +27 -0
- package/dist/native-provider-types/tool-result.d.ts +21 -0
- package/dist/native-providers.d.ts +21 -0
- package/dist/native-providers.js +18402 -0
- package/dist/native-providers.js.map +7 -0
- package/dist/plugin-sdk.js +10640 -225
- package/dist/plugin-sdk.js.map +4 -4
- package/dist/policy/copilot-permission.js +1 -8
- package/dist/providers/copilot/sdk-session.js +8 -1
- package/dist/providers/create-provider.js +20 -0
- package/dist/providers/normalized/adapter.d.ts +107 -0
- package/dist/providers/normalized/adapter.js +1650 -0
- package/dist/providers/normalized/control-policy.d.ts +5 -0
- package/dist/providers/normalized/control-policy.js +12 -0
- package/dist/providers/normalized/interactions.d.ts +3 -0
- package/dist/providers/normalized/interactions.js +39 -0
- package/dist/providers/normalized/legacy-input-ownership.d.ts +34 -0
- package/dist/providers/normalized/legacy-input-ownership.js +123 -0
- package/dist/providers/normalized/session-management.d.ts +67 -0
- package/dist/providers/normalized/session-management.js +334 -0
- package/dist/providers/normalized/session-ownership.d.ts +3 -0
- package/dist/providers/normalized/session-ownership.js +90 -0
- package/dist/providers/provider-adapter.d.ts +43 -1
- package/dist/providers/provider-adapter.js +8 -0
- package/dist/types.d.ts +34 -9
- package/dist/vendor/agent-provider-codex/LICENSE +211 -0
- package/dist/vendor/agent-provider-codex/NOTICE +13 -0
- package/package.json +22 -13
- package/skills/borgee-agent/SKILL.md +1 -1
- package/skills/borgee-agent/scripts/borgee-agent.mjs +24 -3
- package/skills/borgee-agent/scripts/borgee-agent.py +28 -2
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { mkdir, readdir, readFile } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { resolveConnectionsStatePath } from '../../state-paths.js';
|
|
5
|
+
/** Reads ownership evidence without initializing, migrating, or writing default stores. */
|
|
6
|
+
export async function readProtectedCodexSessions(stateRoot) {
|
|
7
|
+
const ids = new Set();
|
|
8
|
+
const names = async (path) => {
|
|
9
|
+
try {
|
|
10
|
+
return await readdir(path);
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
if (error.code === 'ENOENT')
|
|
14
|
+
return [];
|
|
15
|
+
throw error;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const normalized = join(stateRoot, 'native-sessions', 'codex');
|
|
19
|
+
for (const name of await names(normalized)) {
|
|
20
|
+
if (!name.endsWith('.json'))
|
|
21
|
+
continue;
|
|
22
|
+
const records = JSON.parse(await readFile(join(normalized, name), 'utf8'));
|
|
23
|
+
if (!records || typeof records !== 'object' || Array.isArray(records))
|
|
24
|
+
throw new Error('session_ownership_unavailable');
|
|
25
|
+
for (const value of Object.values(records)) {
|
|
26
|
+
const entry = typeof value === 'string' ? JSON.parse(value) : undefined;
|
|
27
|
+
if (!entry?.handle || entry.handle.providerId !== 'codex' || typeof entry.handle.sessionId !== 'string')
|
|
28
|
+
throw new Error('session_ownership_unavailable');
|
|
29
|
+
ids.add(entry.handle.sessionId);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const rootNames = await names(stateRoot);
|
|
33
|
+
for (const name of rootNames) {
|
|
34
|
+
if (!/^codex-channel-sessions-.*\.json$/.test(name))
|
|
35
|
+
continue;
|
|
36
|
+
const records = JSON.parse(await readFile(join(stateRoot, name), 'utf8'));
|
|
37
|
+
if (!records || typeof records !== 'object' || Array.isArray(records))
|
|
38
|
+
throw new Error('session_ownership_unavailable');
|
|
39
|
+
for (const value of Object.values(records)) {
|
|
40
|
+
if (typeof value !== 'string' || !value)
|
|
41
|
+
throw new Error('session_ownership_unavailable');
|
|
42
|
+
ids.add(value);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (rootNames.includes('connections-state.sqlite')) {
|
|
46
|
+
const { DatabaseSync } = createRequire(import.meta.url)('node:sqlite');
|
|
47
|
+
const database = new DatabaseSync(resolveConnectionsStatePath(stateRoot), { readOnly: true });
|
|
48
|
+
try {
|
|
49
|
+
const exists = database.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'provider_channel_sessions'").get();
|
|
50
|
+
if (exists)
|
|
51
|
+
for (const row of database.prepare("SELECT session_id FROM provider_channel_sessions WHERE provider = 'codex'").all()) {
|
|
52
|
+
if (typeof row.session_id !== 'string' || !row.session_id)
|
|
53
|
+
throw new Error('session_ownership_unavailable');
|
|
54
|
+
ids.add(row.session_id);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
database.close();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return ids;
|
|
62
|
+
}
|
|
63
|
+
export function createSessionOwnershipLock(directory) {
|
|
64
|
+
return async (work) => {
|
|
65
|
+
await mkdir(directory, { recursive: true, mode: 0o700 });
|
|
66
|
+
const { DatabaseSync } = createRequire(import.meta.url)('node:sqlite');
|
|
67
|
+
const database = new DatabaseSync(join(directory, '.admission-lock.sqlite'));
|
|
68
|
+
try {
|
|
69
|
+
database.exec('PRAGMA busy_timeout = 0');
|
|
70
|
+
try {
|
|
71
|
+
database.exec('BEGIN IMMEDIATE');
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
if (error.errcode === 5)
|
|
75
|
+
throw new Error('session_ownership_busy');
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
// The OS releases the transaction lock on process exit; never unlink its shared file.
|
|
79
|
+
try {
|
|
80
|
+
return await work();
|
|
81
|
+
}
|
|
82
|
+
finally {
|
|
83
|
+
database.exec('ROLLBACK');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
database.close();
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { SessionControlRequest, SessionControlResponse } from '../plugin-sdk.js';
|
|
2
|
+
import type { AgentInteractionResponse } from '../native-providers.js';
|
|
1
3
|
import type { ProviderAutonomousReply, ProviderGenerateOptions, ProviderInput, ProviderReply } from '../types.js';
|
|
2
4
|
export type ProviderImageInputSupport = 'supported' | 'metadata-only' | 'not-supported';
|
|
3
5
|
export type ProviderImageTransportSupport = 'supported' | 'not-supported';
|
|
@@ -49,13 +51,53 @@ export declare function createHostedProviderCapabilities(params: {
|
|
|
49
51
|
sharedHostFallback?: SharedHostAttachmentMetadataFallbackCapability;
|
|
50
52
|
}): ProviderCapabilities;
|
|
51
53
|
export declare const TEXT_ONLY_HOSTED_PROVIDER_CAPABILITIES: ProviderCapabilities;
|
|
54
|
+
export declare class ProviderInputRejectedError extends Error {
|
|
55
|
+
readonly publicReplyText: string;
|
|
56
|
+
constructor(publicReplyText: string);
|
|
57
|
+
}
|
|
52
58
|
export declare class ProviderTurnCancelledError extends Error {
|
|
53
59
|
readonly publicReplyText?: string;
|
|
54
60
|
constructor(message?: string, options?: {
|
|
55
61
|
publicReplyText?: string;
|
|
56
62
|
});
|
|
57
63
|
}
|
|
64
|
+
export interface ProviderSessionControlContext {
|
|
65
|
+
signal: AbortSignal;
|
|
66
|
+
connectionSignal?: AbortSignal;
|
|
67
|
+
execution?: ProviderGenerateOptions;
|
|
68
|
+
isConnectionCurrent?(): boolean;
|
|
69
|
+
activateExecution?(isCurrent: () => boolean): ProviderGenerateOptions | Promise<ProviderGenerateOptions>;
|
|
70
|
+
onCompletion?(completion: Promise<ProviderReply | undefined>): void;
|
|
71
|
+
}
|
|
72
|
+
export interface ProviderSessionControlResult {
|
|
73
|
+
response: SessionControlResponse;
|
|
74
|
+
completion?: Promise<ProviderReply | undefined>;
|
|
75
|
+
}
|
|
58
76
|
export interface ProviderAdapter {
|
|
77
|
+
readonly supportsSessionManagement?: boolean;
|
|
78
|
+
describeSessionManagement?(): Promise<import('../plugin-sdk.js').SessionManagementAvailability>;
|
|
79
|
+
manageSession?(request: import('../plugin-sdk.js').SessionManagementRequest, context: import('../plugin-sdk.js').ServerRequestContext): Promise<unknown>;
|
|
80
|
+
listSessions?(request: import('../plugin-sdk.js').SessionDirectoryRequest, context: import('../plugin-sdk.js').ServerRequestContext): import('../plugin-sdk.js').SessionDirectoryResult;
|
|
81
|
+
describeSession?(request: import('../plugin-sdk.js').SessionDescriptionRequest, context: import('../plugin-sdk.js').ServerRequestContext): import('../plugin-sdk.js').SessionControlTarget | undefined;
|
|
82
|
+
observeSession?(request: import('../plugin-sdk.js').SessionObservationRequest, context: import('../plugin-sdk.js').ServerRequestContext): Promise<import('../plugin-sdk.js').SessionObservationResult>;
|
|
83
|
+
readonly supportsSessionInput?: boolean;
|
|
84
|
+
readonly sessionInputOperations?: readonly ('start_turn' | 'steer' | 'next_turn')[];
|
|
85
|
+
controlSession?(request: SessionControlRequest, context: ProviderSessionControlContext): Promise<ProviderSessionControlResult>;
|
|
86
|
+
readonly outputMode?: 'legacy' | 'normalized';
|
|
87
|
+
syncNormalizedActivity?(channelId: string, bindingId?: string): boolean;
|
|
88
|
+
setSessionPublication?(publication: {
|
|
89
|
+
supported(): boolean;
|
|
90
|
+
publish(channelId: string, activity: import('../plugin-sdk.js').AgentActivity): boolean;
|
|
91
|
+
}): void;
|
|
92
|
+
publishSessionBindings?(): void;
|
|
93
|
+
respondInteraction?(input: {
|
|
94
|
+
channelId: string;
|
|
95
|
+
taskId?: string;
|
|
96
|
+
agentId: string;
|
|
97
|
+
requestId: string;
|
|
98
|
+
response: AgentInteractionResponse;
|
|
99
|
+
binding?: Pick<SessionControlRequest, 'binding_id' | 'native_session_id' | 'connection_generation'>;
|
|
100
|
+
}, context?: import('../plugin-sdk.js').ServerRequestContext): Promise<AgentInteractionResponse>;
|
|
59
101
|
readonly capabilities: ProviderCapabilities;
|
|
60
102
|
generateReply(input: ProviderInput, options?: ProviderGenerateOptions): Promise<ProviderReply>;
|
|
61
103
|
onAutonomousReply?(handler: ((reply: ProviderAutonomousReply) => void) | undefined): void;
|
|
@@ -64,7 +106,7 @@ export interface ProviderAdapter {
|
|
|
64
106
|
}>;
|
|
65
107
|
interruptTurn?(channelId: string): Promise<boolean>;
|
|
66
108
|
cancelSession?(channelId: string): Promise<boolean>;
|
|
67
|
-
cancelTurn?(channelId: string): Promise<boolean>;
|
|
109
|
+
cancelTurn?(channelId: string, binding?: Pick<SessionControlRequest, 'binding_id' | 'native_session_id' | 'connection_generation'>, context?: import('../plugin-sdk.js').ServerRequestContext): Promise<boolean>;
|
|
68
110
|
cancelBackgroundRun?(channelId: string, providerRunId: string): Promise<boolean>;
|
|
69
111
|
dispose?(): Promise<void>;
|
|
70
112
|
}
|
|
@@ -59,6 +59,14 @@ export const TEXT_ONLY_HOSTED_PROVIDER_CAPABILITIES = createHostedProviderCapabi
|
|
|
59
59
|
targetedCancellation: 'not-supported',
|
|
60
60
|
},
|
|
61
61
|
});
|
|
62
|
+
export class ProviderInputRejectedError extends Error {
|
|
63
|
+
publicReplyText;
|
|
64
|
+
constructor(publicReplyText) {
|
|
65
|
+
super(publicReplyText);
|
|
66
|
+
this.publicReplyText = publicReplyText;
|
|
67
|
+
this.name = 'ProviderInputRejectedError';
|
|
68
|
+
}
|
|
69
|
+
}
|
|
62
70
|
export class ProviderTurnCancelledError extends Error {
|
|
63
71
|
publicReplyText;
|
|
64
72
|
constructor(message = 'provider turn cancelled', options) {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AgentCapabilities, AgentStreamEvent, ProviderObservation } from './native-providers.js';
|
|
2
|
+
import type { ChannelFileContent as SdkChannelFileContent, ExecutionGrant } from './plugin-sdk.js';
|
|
2
3
|
export type ProviderKind = 'claude' | 'codex' | 'copilot';
|
|
3
4
|
export type ProjectionStrategy = 'session-brief' | 'turn-full' | 'message-only' | 'turn-thin' | 'file-brief';
|
|
4
5
|
export interface ProviderCommandConfig {
|
|
6
|
+
providerOutputMode?: 'legacy' | 'normalized';
|
|
7
|
+
nativeProviderCommand?: string;
|
|
8
|
+
sessionWorkspaceRoot?: string;
|
|
9
|
+
codexConnectionMode?: 'shared' | 'stdio';
|
|
10
|
+
codexSharedSocketPath?: string;
|
|
11
|
+
/** Explicit local consent to control the shared Codex daemon under its native permissions. */
|
|
12
|
+
codexTrustShared?: boolean;
|
|
5
13
|
claudeCommand: string;
|
|
6
14
|
claudeArgs: string[];
|
|
7
15
|
codexCommand: string;
|
|
@@ -100,6 +108,8 @@ export interface LocalConfigGenerateResult {
|
|
|
100
108
|
warnings: LocalConfigGenerateWarning[];
|
|
101
109
|
}
|
|
102
110
|
export interface ChannelMessageEvent {
|
|
111
|
+
sessionTarget?: import('./plugin-sdk.js').SessionMessageTarget;
|
|
112
|
+
sourceCurrent?: () => boolean;
|
|
103
113
|
type?: string;
|
|
104
114
|
message_type?: string;
|
|
105
115
|
channel_id: string;
|
|
@@ -153,14 +163,7 @@ export interface ChannelFileEntry {
|
|
|
153
163
|
createdAt: number;
|
|
154
164
|
updatedAt: number;
|
|
155
165
|
}
|
|
156
|
-
export
|
|
157
|
-
path: string;
|
|
158
|
-
filename: string;
|
|
159
|
-
contentType: string;
|
|
160
|
-
sizeBytes: number;
|
|
161
|
-
base64?: string;
|
|
162
|
-
text?: string;
|
|
163
|
-
}
|
|
166
|
+
export type ChannelFileContent = SdkChannelFileContent;
|
|
164
167
|
export interface PublishChannelFileInput {
|
|
165
168
|
channelId: string;
|
|
166
169
|
path: string;
|
|
@@ -322,6 +325,13 @@ export interface ProviderInput {
|
|
|
322
325
|
incomingParts?: HostedTurnContentPart[];
|
|
323
326
|
incomingEventKind?: string;
|
|
324
327
|
incomingMessageType?: string;
|
|
328
|
+
selectedSession?: import('./plugin-sdk.js').SessionMessageTarget & {
|
|
329
|
+
sourceCurrent?: () => boolean;
|
|
330
|
+
};
|
|
331
|
+
independentSessionWorkspace?: {
|
|
332
|
+
bindingId: string;
|
|
333
|
+
cwd: string;
|
|
334
|
+
};
|
|
325
335
|
collaboration?: ProviderCollaborationContext;
|
|
326
336
|
collaborationOutcome?: CollaborationOutcomeSnapshot;
|
|
327
337
|
attentionSnapshot?: AttentionSnapshot;
|
|
@@ -373,6 +383,7 @@ export interface LocalhostGatewayBootstrapMetadata {
|
|
|
373
383
|
export interface TaskAssignmentThreadContext {
|
|
374
384
|
active: true;
|
|
375
385
|
currentTaskId?: string;
|
|
386
|
+
taskChannelId?: string;
|
|
376
387
|
}
|
|
377
388
|
export interface ChannelResolvedWorkingFolderContext {
|
|
378
389
|
authority: 'channel';
|
|
@@ -449,6 +460,8 @@ export interface PreparedProviderTurnInput {
|
|
|
449
460
|
incomingEventKind?: string;
|
|
450
461
|
incomingMessageType?: string;
|
|
451
462
|
prompt: string;
|
|
463
|
+
/** Context preparation failed; native separate-context admission must not proceed. */
|
|
464
|
+
contextPreparationFailed?: boolean;
|
|
452
465
|
/** Claude-only session append content for ACP systemPrompt.append. */
|
|
453
466
|
claudeSessionPromptAppend?: string;
|
|
454
467
|
/** Shared projection-strategy selector used for provider prompt/session experiments. */
|
|
@@ -626,6 +639,18 @@ export type ProviderProgressUpdate = {
|
|
|
626
639
|
run: ProviderBackgroundRunProgress;
|
|
627
640
|
};
|
|
628
641
|
export interface ProviderGenerateOptions {
|
|
642
|
+
normalizedTaskId?: string;
|
|
643
|
+
/** Durable Borgee input identity; distinct from a browser optimistic request id. */
|
|
644
|
+
normalizedInputMessageId?: string;
|
|
645
|
+
/** Authoritative durable Borgee body; null means unavailable. Native observations remain canonical after admission. */
|
|
646
|
+
normalizedInputText?: string | null;
|
|
647
|
+
onNormalizedObservation?: (event: AgentStreamEvent, borgeeAgentId: string, observation?: ProviderObservation, sessionCapabilities?: AgentCapabilities, sessionControlBindingId?: string, timelineEpoch?: string, sessionPublished?: boolean) => void;
|
|
648
|
+
normalizedStateSink?: {
|
|
649
|
+
observe(observation: ProviderObservation, borgeeAgentId: string, sessionCapabilities?: AgentCapabilities, sessionControlBindingId?: string, timelineEpoch?: string): void;
|
|
650
|
+
sessionActivity?(activity: import('./plugin-sdk.js').AgentActivity): boolean;
|
|
651
|
+
snapshot?(value: import('./native-providers.js').AgentSnapshot, sessionControlBindingId?: string, timelineEpoch?: string): boolean;
|
|
652
|
+
close(): void;
|
|
653
|
+
};
|
|
629
654
|
onProgress?: (update: ProviderProgressUpdate) => void;
|
|
630
655
|
onUsage?: (usage: ProviderTokenUsage) => void;
|
|
631
656
|
onExecutionContinuation?: (completion: Promise<boolean>) => void;
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
Copyright (c) 2025-present Mohamed Boudra
|
|
2
|
+
|
|
3
|
+
Portions of this software are licensed as follows:
|
|
4
|
+
|
|
5
|
+
* Third-party components incorporated into Paseo remain licensed under
|
|
6
|
+
the licenses provided by their respective copyright holders.
|
|
7
|
+
* Except for those third-party components, Paseo is licensed under the
|
|
8
|
+
Apache License, Version 2.0, reproduced below.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
Apache License
|
|
12
|
+
Version 2.0, January 2004
|
|
13
|
+
http://www.apache.org/licenses/
|
|
14
|
+
|
|
15
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
16
|
+
|
|
17
|
+
1. Definitions.
|
|
18
|
+
|
|
19
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
20
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
21
|
+
|
|
22
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
23
|
+
the copyright owner that is granting the License.
|
|
24
|
+
|
|
25
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
26
|
+
other entities that control, are controlled by, or are under common
|
|
27
|
+
control with that entity. For the purposes of this definition,
|
|
28
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
29
|
+
direction or management of such entity, whether by contract or
|
|
30
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
31
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
32
|
+
|
|
33
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
34
|
+
exercising permissions granted by this License.
|
|
35
|
+
|
|
36
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
37
|
+
including but not limited to software source code, documentation
|
|
38
|
+
source, and configuration files.
|
|
39
|
+
|
|
40
|
+
"Object" form shall mean any form resulting from mechanical
|
|
41
|
+
transformation or translation of a Source form, including but
|
|
42
|
+
not limited to compiled object code, generated documentation,
|
|
43
|
+
and conversions to other media types.
|
|
44
|
+
|
|
45
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
46
|
+
Object form, made available under the License, as indicated by a
|
|
47
|
+
copyright notice that is included in or attached to the work
|
|
48
|
+
(an example is provided in the Appendix below).
|
|
49
|
+
|
|
50
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
51
|
+
form, that is based on (or derived from) the Work and for which the
|
|
52
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
53
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
54
|
+
of this License, Derivative Works shall not include works that remain
|
|
55
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
56
|
+
the Work and Derivative Works thereof.
|
|
57
|
+
|
|
58
|
+
"Contribution" shall mean any work of authorship, including
|
|
59
|
+
the original version of the Work and any modifications or additions
|
|
60
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
61
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
62
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
63
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
64
|
+
means any form of electronic, verbal, or written communication sent
|
|
65
|
+
to the Licensor or its representatives, including but not limited to
|
|
66
|
+
communication on electronic mailing lists, source code control systems,
|
|
67
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
68
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
69
|
+
excluding communication that is conspicuously marked or otherwise
|
|
70
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
71
|
+
|
|
72
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
73
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
74
|
+
subsequently incorporated within the Work.
|
|
75
|
+
|
|
76
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
77
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
78
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
79
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
80
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
81
|
+
Work and such Derivative Works in Source or Object form.
|
|
82
|
+
|
|
83
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
84
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
85
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
86
|
+
(except as stated in this section) patent license to make, have made,
|
|
87
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
88
|
+
where such license applies only to those patent claims licensable
|
|
89
|
+
by such Contributor that are necessarily infringed by their
|
|
90
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
91
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
92
|
+
institute patent litigation against any entity (including a
|
|
93
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
94
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
95
|
+
or contributory patent infringement, then any patent licenses
|
|
96
|
+
granted to You under this License for that Work shall terminate
|
|
97
|
+
as of the date such litigation is filed.
|
|
98
|
+
|
|
99
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
100
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
101
|
+
modifications, and in Source or Object form, provided that You
|
|
102
|
+
meet the following conditions:
|
|
103
|
+
|
|
104
|
+
(a) You must give any other recipients of the Work or
|
|
105
|
+
Derivative Works a copy of this License; and
|
|
106
|
+
|
|
107
|
+
(b) You must cause any modified files to carry prominent notices
|
|
108
|
+
stating that You changed the files; and
|
|
109
|
+
|
|
110
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
111
|
+
that You distribute, all copyright, patent, trademark, and
|
|
112
|
+
attribution notices from the Source form of the Work,
|
|
113
|
+
excluding those notices that do not pertain to any part of
|
|
114
|
+
the Derivative Works; and
|
|
115
|
+
|
|
116
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
117
|
+
distribution, then any Derivative Works that You distribute must
|
|
118
|
+
include a readable copy of the attribution notices contained
|
|
119
|
+
within such NOTICE file, excluding those notices that do not
|
|
120
|
+
pertain to any part of the Derivative Works, in at least one
|
|
121
|
+
of the following places: within a NOTICE text file distributed
|
|
122
|
+
as part of the Derivative Works; within the Source form or
|
|
123
|
+
documentation, if provided along with the Derivative Works; or,
|
|
124
|
+
within a display generated by the Derivative Works, if and
|
|
125
|
+
wherever such third-party notices normally appear. The contents
|
|
126
|
+
of the NOTICE file are for informational purposes only and
|
|
127
|
+
do not modify the License. You may add Your own attribution
|
|
128
|
+
notices within Derivative Works that You distribute, alongside
|
|
129
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
130
|
+
that such additional attribution notices cannot be construed
|
|
131
|
+
as modifying the License.
|
|
132
|
+
|
|
133
|
+
You may add Your own copyright statement to Your modifications and
|
|
134
|
+
may provide additional or different license terms and conditions
|
|
135
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
136
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
137
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
138
|
+
the conditions stated in this License.
|
|
139
|
+
|
|
140
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
141
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
142
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
143
|
+
this License, without any additional terms or conditions.
|
|
144
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
145
|
+
the terms of any separate license agreement you may have executed
|
|
146
|
+
with Licensor regarding such Contributions.
|
|
147
|
+
|
|
148
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
149
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
150
|
+
except as required for reasonable and customary use in describing the
|
|
151
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
152
|
+
|
|
153
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
154
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
155
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
156
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
157
|
+
implied, including, without limitation, any warranties or conditions
|
|
158
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
159
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
160
|
+
appropriateness of using or redistributing the Work and assume any
|
|
161
|
+
risks associated with Your exercise of permissions under this License.
|
|
162
|
+
|
|
163
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
164
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
165
|
+
unless required by applicable law (such as deliberate and grossly
|
|
166
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
167
|
+
liable to You for damages, including any direct, indirect, special,
|
|
168
|
+
incidental, or consequential damages of any character arising as a
|
|
169
|
+
result of this License or out of the use or inability to use the
|
|
170
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
171
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
172
|
+
other commercial damages or losses), even if such Contributor
|
|
173
|
+
has been advised of the possibility of such damages.
|
|
174
|
+
|
|
175
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
176
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
177
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
178
|
+
or other liability obligations and/or rights consistent with this
|
|
179
|
+
License. However, in accepting such obligations, You may act only
|
|
180
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
181
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
182
|
+
defend, and hold each Contributor harmless for any liability
|
|
183
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
184
|
+
of your accepting any such warranty or additional liability.
|
|
185
|
+
|
|
186
|
+
END OF TERMS AND CONDITIONS
|
|
187
|
+
|
|
188
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
189
|
+
|
|
190
|
+
To apply the Apache License to your work, attach the following
|
|
191
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
192
|
+
replaced with your own identifying information. (Don't include
|
|
193
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
194
|
+
comment syntax for the file format. We also recommend that a
|
|
195
|
+
file or class name and description of purpose be included on the
|
|
196
|
+
same "printed page" as the copyright notice for easier
|
|
197
|
+
identification within third-party archives.
|
|
198
|
+
|
|
199
|
+
Copyright [yyyy] [name of copyright owner]
|
|
200
|
+
|
|
201
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
202
|
+
you may not use this file except in compliance with the License.
|
|
203
|
+
You may obtain a copy of the License at
|
|
204
|
+
|
|
205
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
206
|
+
|
|
207
|
+
Unless required by applicable law or agreed to in writing, software
|
|
208
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
209
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
210
|
+
See the License for the specific language governing permissions and
|
|
211
|
+
limitations under the License.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
This package contains code derived from Paseo commit
|
|
2
|
+
463415ae846cbcfef0df691e413a1a73a9213757.
|
|
3
|
+
|
|
4
|
+
Paseo copyright (c) 2025-present Mohamed Boudra.
|
|
5
|
+
Paseo is licensed under the Apache License, Version 2.0, reproduced in LICENSE.
|
|
6
|
+
|
|
7
|
+
The derived code has been adapted to Borgee-owned Provider contracts and
|
|
8
|
+
substantially reorganized into transport, native parsing, projection, history,
|
|
9
|
+
session, and provider modules.
|
|
10
|
+
|
|
11
|
+
Native daemon client recovery and routing are derived from Agent Remote Control
|
|
12
|
+
commit 7174e085e60cd5bba80653c993870261fe040936, packages/codex-daemon-client
|
|
13
|
+
and its Provider runtime bridge, licensed under Apache-2.0.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@borgee/agents-host",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.110",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -26,9 +26,12 @@
|
|
|
26
26
|
"@agentclientprotocol/sdk": "1.3.0",
|
|
27
27
|
"@anthropic-ai/claude-agent-sdk": "0.3.220",
|
|
28
28
|
"@github/copilot-sdk": "1.0.11",
|
|
29
|
+
"@sinclair/typebox": "0.34.52",
|
|
29
30
|
"cross-spawn": "^7.0.6",
|
|
30
31
|
"yaml": "^2.8.1",
|
|
31
|
-
"zod": "4.4.3"
|
|
32
|
+
"zod": "4.4.3",
|
|
33
|
+
"@borgee/claude-native-sdk": "npm:@anthropic-ai/claude-agent-sdk@0.3.247",
|
|
34
|
+
"@github/copilot": "1.0.83"
|
|
32
35
|
},
|
|
33
36
|
"devDependencies": {
|
|
34
37
|
"@agentclientprotocol/claude-agent-acp": "0.64.0",
|
|
@@ -38,24 +41,30 @@
|
|
|
38
41
|
"tsx": "^4.20.5",
|
|
39
42
|
"typescript": "^5.9.3",
|
|
40
43
|
"vitest": "^4.1.5",
|
|
41
|
-
"@borgee/
|
|
44
|
+
"@borgee/agent-provider-sdk": "0.3.1",
|
|
45
|
+
"@borgee/agent-provider-codex": "0.3.1",
|
|
46
|
+
"@borgee/agent-provider-claude": "0.1.0",
|
|
47
|
+
"@borgee/agent-remote-protocol": "0.2.2",
|
|
48
|
+
"@borgee/plugin-sdk": "0.16.4",
|
|
49
|
+
"@borgee/agent-provider-copilot": "0.1.0"
|
|
42
50
|
},
|
|
43
51
|
"scripts": {
|
|
44
|
-
"predev": "pnpm --filter @borgee/agent-
|
|
52
|
+
"predev": "pnpm --filter @borgee/plugin-sdk... --filter @borgee/agent-provider-codex... --filter @borgee/agent-provider-claude... --filter @borgee/agent-provider-copilot... run build && pnpm run vendor:claude",
|
|
45
53
|
"dev": "tsx src/index.ts",
|
|
46
|
-
"precli": "pnpm --filter @borgee/agent-
|
|
54
|
+
"precli": "pnpm --filter @borgee/plugin-sdk... --filter @borgee/agent-provider-codex... --filter @borgee/agent-provider-claude... --filter @borgee/agent-provider-copilot... run build && pnpm run vendor:claude",
|
|
47
55
|
"cli": "tsx src/cli.ts",
|
|
48
|
-
"prestart": "pnpm --filter @borgee/agent-
|
|
56
|
+
"prestart": "pnpm --filter @borgee/plugin-sdk... --filter @borgee/agent-provider-codex... --filter @borgee/agent-provider-claude... --filter @borgee/agent-provider-copilot... run build",
|
|
49
57
|
"start": "node dist/index.js",
|
|
50
|
-
"prebuild": "pnpm --filter @borgee/agent-
|
|
51
|
-
"build": "tsc && node scripts/bundle-plugin-sdk.mjs && node scripts/vendor-claude-acp.mjs",
|
|
52
|
-
"test:package": "node --test --test-timeout=10000 scripts/packed-package-descriptor.test.mjs && pnpm run build && node scripts/test-packed-claude-lifecycle.mjs",
|
|
58
|
+
"prebuild": "pnpm --filter @borgee/plugin-sdk... --filter @borgee/agent-provider-codex... --filter @borgee/agent-provider-claude... --filter @borgee/agent-provider-copilot... run build",
|
|
59
|
+
"build": "tsc && node scripts/bundle-plugin-sdk.mjs && node scripts/bundle-native-providers.mjs && node scripts/vendor-claude-acp.mjs",
|
|
60
|
+
"test:package": "node --test --test-timeout=10000 scripts/packed-package-descriptor.test.mjs && pnpm run build && node scripts/test-packed-claude-lifecycle.mjs && node scripts/test-packed-native-providers.mjs",
|
|
53
61
|
"typecheck": "tsc --noEmit",
|
|
54
|
-
"pretest": "pnpm --filter @borgee/agent-
|
|
62
|
+
"pretest": "pnpm --filter @borgee/plugin-sdk... --filter @borgee/agent-provider-codex... --filter @borgee/agent-provider-claude... --filter @borgee/agent-provider-copilot... run build && pnpm run vendor:claude",
|
|
55
63
|
"test": "vitest run --testTimeout=10000",
|
|
56
|
-
"pretest:e2e": "pnpm --filter @borgee/agent-
|
|
64
|
+
"pretest:e2e": "pnpm --filter @borgee/plugin-sdk... --filter @borgee/agent-provider-codex... --filter @borgee/agent-provider-claude... --filter @borgee/agent-provider-copilot... run build && pnpm run vendor:claude",
|
|
57
65
|
"test:e2e": "vitest run --config vitest.e2e.config.ts --testTimeout=120000",
|
|
58
|
-
"pretypecheck": "pnpm --filter @borgee/agent-
|
|
59
|
-
"vendor:claude": "node scripts/vendor-claude-acp.mjs"
|
|
66
|
+
"pretypecheck": "pnpm --filter @borgee/plugin-sdk... --filter @borgee/agent-provider-codex... --filter @borgee/agent-provider-claude... --filter @borgee/agent-provider-copilot... run build",
|
|
67
|
+
"vendor:claude": "node scripts/vendor-claude-acp.mjs",
|
|
68
|
+
"test:package:native": "node scripts/test-packed-native-providers.mjs"
|
|
60
69
|
}
|
|
61
70
|
}
|
|
@@ -53,7 +53,7 @@ Everything below writes that leading interpreter and script path as `borgee-agen
|
|
|
53
53
|
| `whoami` | This agent's own id and display name. |
|
|
54
54
|
| `history [--limit <n>] [--before <n>] [--after <n>]` | Recent messages in this channel. At most 20 per call — a larger `--limit` is silently reduced to 20, so page with `--before` rather than asking for more. `--before` and `--after` are `createdAt` epoch-millisecond cursors copied from a message you already hold, not message ids and not counts. |
|
|
55
55
|
| `files` | Files visible in this channel, returned as a flattened list with stable root-relative paths and basic metadata. |
|
|
56
|
-
| `files cat <channel-path>` | Print one UTF-8
|
|
56
|
+
| `files cat <channel-path>` | Print one file as normalized text. Markdown, text, JSON and YAML are supported directly; invalid structured input and unknown UTF-8 types use an explicit fallback. When extraction is unavailable or failed, the command prints the status and warnings to stderr and exits nonzero instead of printing binary bytes. Normalized text is limited to 64 KiB. |
|
|
57
57
|
| `files download <channel-path> [--overwrite]` | Copy one channel file to `<execution.local_directory>/.borgee/channel-files/<channel-path>`. The default refuses an existing working copy. |
|
|
58
58
|
| `files sync [<channel-path>] [--overwrite]` | Copy every visible file, or one exact path/subtree, into the same fixed working-copy directory. File bytes never appear in command output. |
|
|
59
59
|
| `files publish <local-relative-path> --channel-path <channel-path> [--content-type <mime>] [--overwrite]` | Explicitly publish one regular file under `execution.local_directory`. The default is create-only; `--overwrite` is required to replace an existing channel file. |
|
|
@@ -21,7 +21,7 @@ Commands:
|
|
|
21
21
|
files
|
|
22
22
|
Files visible in this channel.
|
|
23
23
|
files cat <channel-path>
|
|
24
|
-
Print
|
|
24
|
+
Print normalized UTF-8 text, or report extraction status and warnings.
|
|
25
25
|
files download <channel-path> [--overwrite]
|
|
26
26
|
Copy one file into execution.local_directory/.borgee/channel-files.
|
|
27
27
|
files sync [<channel-path>] [--overwrite]
|
|
@@ -610,6 +610,26 @@ async function callGateway(credential, request) {
|
|
|
610
610
|
return responseBody;
|
|
611
611
|
}
|
|
612
612
|
|
|
613
|
+
function requireExtractedText(result, path) {
|
|
614
|
+
if (typeof result?.text === 'string') {
|
|
615
|
+
return result.text;
|
|
616
|
+
}
|
|
617
|
+
const extraction = result?.extraction;
|
|
618
|
+
const status = typeof extraction?.status === 'string' ? extraction.status : 'unavailable';
|
|
619
|
+
const warnings = Array.isArray(extraction?.warnings)
|
|
620
|
+
? extraction.warnings.flatMap((warning) => {
|
|
621
|
+
if (warning === null || typeof warning !== 'object') {
|
|
622
|
+
return [];
|
|
623
|
+
}
|
|
624
|
+
const code = typeof warning.code === 'string' ? warning.code : 'UNKNOWN';
|
|
625
|
+
const message = typeof warning.message === 'string' ? warning.message : 'No details';
|
|
626
|
+
return [`${code}: ${message}`];
|
|
627
|
+
})
|
|
628
|
+
: [];
|
|
629
|
+
const detail = warnings.length > 0 ? `; ${warnings.join('; ')}` : '';
|
|
630
|
+
throw new Error(`Cannot print ${path}: text extraction is ${status}${detail}`);
|
|
631
|
+
}
|
|
632
|
+
|
|
613
633
|
async function main() {
|
|
614
634
|
const parsed = parseArgs(process.argv.slice(2));
|
|
615
635
|
if (parsed.help === true) {
|
|
@@ -624,8 +644,9 @@ async function main() {
|
|
|
624
644
|
const credential = await readGatewayCredential(parsed.gatewayCredentialPath);
|
|
625
645
|
const result = await callGateway(credential, resolveRequest(credential, parsed));
|
|
626
646
|
if (parsed.command === 'files' && parsed.fileCommand === 'cat') {
|
|
627
|
-
|
|
628
|
-
|
|
647
|
+
const text = requireExtractedText(result, parsed.filePath);
|
|
648
|
+
process.stdout.write(text);
|
|
649
|
+
if (!text.endsWith('\n')) {
|
|
629
650
|
process.stdout.write('\n');
|
|
630
651
|
}
|
|
631
652
|
return 0;
|