@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,124 @@
|
|
|
1
|
+
import type { AgentInteractionResponse } from './control.js';
|
|
2
|
+
import type { AgentRuntimeInfo, ProviderStreamItem } from './observation.js';
|
|
3
|
+
export interface AgentCapabilities {
|
|
4
|
+
history: boolean;
|
|
5
|
+
sendMessage: boolean;
|
|
6
|
+
queueMessage?: boolean;
|
|
7
|
+
steer: boolean;
|
|
8
|
+
cancel: boolean;
|
|
9
|
+
/** The session can return content for supported resource locators; this does not imply arbitrary URI access or inline rendering. */
|
|
10
|
+
readResource: boolean;
|
|
11
|
+
sessionSettings?: boolean;
|
|
12
|
+
commands?: boolean;
|
|
13
|
+
planning?: boolean;
|
|
14
|
+
interactions: {
|
|
15
|
+
question: boolean;
|
|
16
|
+
planApproval: boolean;
|
|
17
|
+
toolApproval: boolean;
|
|
18
|
+
form?: boolean;
|
|
19
|
+
permissionApproval?: boolean;
|
|
20
|
+
externalAction?: boolean;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface AgentProviderDescriptor {
|
|
24
|
+
providerId: string;
|
|
25
|
+
displayName: string;
|
|
26
|
+
/** Emits a complete session_restored state after the history boundary, before admitting live observation or input. */
|
|
27
|
+
sessionObservation?: 'complete-state';
|
|
28
|
+
/** Explicit input operations with receipt and expected-turn semantics. */
|
|
29
|
+
sessionInputOperations?: readonly ('start_turn' | 'steer' | 'next_turn')[];
|
|
30
|
+
}
|
|
31
|
+
export interface AgentPersistenceHandle {
|
|
32
|
+
providerId: string;
|
|
33
|
+
sessionId: string;
|
|
34
|
+
opaque: string;
|
|
35
|
+
}
|
|
36
|
+
/** An adapter-confirmed ownership conflict, with a message safe for remote clients. */
|
|
37
|
+
export declare class AgentSessionInUseError extends Error {
|
|
38
|
+
constructor(message: string);
|
|
39
|
+
}
|
|
40
|
+
export interface AgentSessionConfig {
|
|
41
|
+
sessionId: string;
|
|
42
|
+
cwd?: string;
|
|
43
|
+
/** Extra native working-directory roots, still subject to native tool permissions. Unsupported providers reject this option. */
|
|
44
|
+
additionalDirectories?: string[];
|
|
45
|
+
model?: string;
|
|
46
|
+
reasoningEffort?: string;
|
|
47
|
+
systemPrompt?: string;
|
|
48
|
+
planning?: boolean;
|
|
49
|
+
}
|
|
50
|
+
export interface AgentSessionResumeOptions {
|
|
51
|
+
/** Replaces saved directory roots; an empty array clears them and undefined preserves them. Unsupported providers reject a supplied value. */
|
|
52
|
+
additionalDirectories?: string[];
|
|
53
|
+
}
|
|
54
|
+
export interface AgentProviderAdapter {
|
|
55
|
+
readonly descriptor: AgentProviderDescriptor;
|
|
56
|
+
createSession(config: AgentSessionConfig): Promise<AgentSession>;
|
|
57
|
+
resumeSession(handle: AgentPersistenceHandle, options?: AgentSessionResumeOptions): Promise<AgentSession>;
|
|
58
|
+
/** Opens an observed direct child of a loaded parent; never discovers or resumes arbitrary sessions. */
|
|
59
|
+
openChildSession?(parentNativeSessionId: string, childNativeSessionId: string): Promise<AgentSession>;
|
|
60
|
+
/** Releases provider resources after every owned session has been disposed. */
|
|
61
|
+
dispose?(): Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
export interface AgentMessageOptions {
|
|
64
|
+
/** Native context fragments, separate from user content and admitted only with a new idle turn. Never implicitly steers; unsupported providers reject a supplied value. */
|
|
65
|
+
additionalContext?: Record<string, {
|
|
66
|
+
kind: 'application' | 'untrusted';
|
|
67
|
+
value: string;
|
|
68
|
+
}>;
|
|
69
|
+
/** Opaque caller input identity echoed by a supporting native transport. */
|
|
70
|
+
clientMessageId?: string;
|
|
71
|
+
/** Immediate input joins active work; next_turn uses the native follow-up queue. */
|
|
72
|
+
delivery?: 'immediate' | 'next_turn';
|
|
73
|
+
/** Refuses input unless the provider can admit a new native turn without steering active work. */
|
|
74
|
+
requireIdle?: boolean;
|
|
75
|
+
}
|
|
76
|
+
export type AgentMessageReceipt = {
|
|
77
|
+
/** Native message identity shared with the normalized user_message item. */
|
|
78
|
+
messageId?: string;
|
|
79
|
+
/** Native accepted turn identity; distinct from the input message identity. */
|
|
80
|
+
turnId?: string;
|
|
81
|
+
} & ({
|
|
82
|
+
messageId: string;
|
|
83
|
+
} | {
|
|
84
|
+
turnId: string;
|
|
85
|
+
});
|
|
86
|
+
export interface AgentSteerOptions {
|
|
87
|
+
/** Opaque caller input identity echoed by a supporting native transport. */
|
|
88
|
+
clientMessageId?: string;
|
|
89
|
+
/** Captured normalized turn identity; a mismatch must not start another turn. */
|
|
90
|
+
expectedTurnId?: string;
|
|
91
|
+
}
|
|
92
|
+
/** Native input was refused before admission; retry is a caller decision. */
|
|
93
|
+
export declare class AgentInputRejectedError extends Error {
|
|
94
|
+
readonly reason?: "context_unavailable" | undefined;
|
|
95
|
+
constructor(message: string, reason?: "context_unavailable" | undefined);
|
|
96
|
+
}
|
|
97
|
+
export interface AgentSession {
|
|
98
|
+
readonly capabilities: AgentCapabilities;
|
|
99
|
+
/** A session observation may span turn completion and saved/live descriptor transitions; iterator termination means this observer ended. */
|
|
100
|
+
observe(): AsyncIterable<ProviderStreamItem>;
|
|
101
|
+
sendMessage(text: string, options?: AgentMessageOptions): Promise<void | AgentMessageReceipt>;
|
|
102
|
+
/** Native pending input message identities; unavailable or ambiguous snapshots reject. */
|
|
103
|
+
listPendingInputs?(): Promise<string[]>;
|
|
104
|
+
respondToInteraction(requestId: string, response: AgentInteractionResponse): Promise<void>;
|
|
105
|
+
steer?(text: string, options?: AgentSteerOptions): Promise<void | AgentMessageReceipt>;
|
|
106
|
+
cancel?(): Promise<void>;
|
|
107
|
+
setPlanning?(active: boolean): Promise<void>;
|
|
108
|
+
setSessionSetting?(id: string, value: string): Promise<void>;
|
|
109
|
+
listCommands?(): Promise<import('./commands.js').AgentCommand[]>;
|
|
110
|
+
executeCommand?(id: string, args: string): Promise<import('./commands.js').AgentCommandResult>;
|
|
111
|
+
/** Reads within this session's supported resource scope; unavailable resources return an unavailable result. */
|
|
112
|
+
readResource?(locator: string): Promise<AgentResourceReadResult>;
|
|
113
|
+
runtimeInfo(): Promise<AgentRuntimeInfo>;
|
|
114
|
+
/** Releases this observer's resources without implying cancellation of separately owned native execution. */
|
|
115
|
+
dispose(): Promise<void>;
|
|
116
|
+
}
|
|
117
|
+
export type AgentResourceReadResult = {
|
|
118
|
+
status: 'available';
|
|
119
|
+
bytes: Uint8Array;
|
|
120
|
+
mediaType: string;
|
|
121
|
+
} | {
|
|
122
|
+
status: 'unavailable';
|
|
123
|
+
reason: string;
|
|
124
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface AgentSessionSettingOption {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
}
|
|
6
|
+
/** A native selection; values are opaque outside the declaring Provider. */
|
|
7
|
+
export interface AgentSessionSetting {
|
|
8
|
+
id: string;
|
|
9
|
+
category: 'model' | 'permissions';
|
|
10
|
+
label: string;
|
|
11
|
+
value: string | null;
|
|
12
|
+
options: AgentSessionSettingOption[];
|
|
13
|
+
mutable: boolean;
|
|
14
|
+
scope: 'session' | 'session_and_default';
|
|
15
|
+
description?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function validateSessionSetting(settings: readonly AgentSessionSetting[] | undefined, id: string, value: string): AgentSessionSetting;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AgentSession, ProviderObservation, ProviderStreamItem } from './index.js';
|
|
2
|
+
import type { AgentProviderAdapter, AgentSessionConfig } from './index.js';
|
|
3
|
+
export interface CollectedProviderStream {
|
|
4
|
+
history: ProviderObservation[];
|
|
5
|
+
live: ProviderObservation[];
|
|
6
|
+
boundary: Extract<ProviderStreamItem, {
|
|
7
|
+
type: 'history_boundary';
|
|
8
|
+
}>;
|
|
9
|
+
replacements: Extract<ProviderStreamItem, {
|
|
10
|
+
type: 'timeline_replacement';
|
|
11
|
+
}>[];
|
|
12
|
+
initialState?: Extract<ProviderStreamItem, {
|
|
13
|
+
type: 'session_restored';
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
16
|
+
export declare function collectProviderStream(session: AgentSession, liveCount: number, observationContract?: 'complete-state'): Promise<CollectedProviderStream>;
|
|
17
|
+
export declare function validateAgentSessionCapabilities(session: AgentSession): void;
|
|
18
|
+
export interface AgentProviderContractFixture {
|
|
19
|
+
adapter: AgentProviderAdapter;
|
|
20
|
+
createConfig: AgentSessionConfig;
|
|
21
|
+
expected: {
|
|
22
|
+
providerId: string;
|
|
23
|
+
historyCount: number;
|
|
24
|
+
liveCount: number;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export declare function runAgentProviderContractTests(name: string, factory: () => Promise<AgentProviderContractFixture>): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type AgentToolResultJson = null | boolean | number | string | AgentToolResultJson[] | {
|
|
2
|
+
[key: string]: AgentToolResultJson;
|
|
3
|
+
};
|
|
4
|
+
export type AgentToolResultContent = {
|
|
5
|
+
type: 'text';
|
|
6
|
+
text: string;
|
|
7
|
+
stream?: 'stdout' | 'stderr' | 'combined';
|
|
8
|
+
} | {
|
|
9
|
+
type: 'json';
|
|
10
|
+
value: AgentToolResultJson;
|
|
11
|
+
};
|
|
12
|
+
export interface AgentToolResult {
|
|
13
|
+
content: AgentToolResultContent[];
|
|
14
|
+
exitCode?: number;
|
|
15
|
+
durationMs?: number;
|
|
16
|
+
truncated?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare const TOOL_RESULT_MAX_CHARS: number;
|
|
19
|
+
export declare const TOOL_RESULT_MAX_BLOCKS = 128;
|
|
20
|
+
/** Result bodies are bounded snapshots; consumers replace them instead of appending. */
|
|
21
|
+
export declare function boundToolResult(result: AgentToolResult): AgentToolResult;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AgentInteractionResponse, AgentProviderAdapter, AgentSession } from "./native-provider-types/index.js";
|
|
2
|
+
export { AgentCommandRejectedError, AgentInputRejectedError, AgentSessionInUseError, redactInteractionRequest, redactInteractionResponse, validateInteractionResponse as validateNativeInteractionResponse } from "./native-provider-types/index.js";
|
|
3
|
+
export type { AgentTimelineItem, AgentQuestionnaireResponse, AgentCapabilities, AgentInteractionRequest, AgentInteractionResponse, AgentMessageReceipt, AgentPersistenceHandle, AgentProviderAdapter, AgentRuntimeInfo, AgentSession, AgentStreamEvent, ProviderObservation, ProviderStreamItem, ProviderSessionRestored } from "./native-provider-types/index.js";
|
|
4
|
+
export { decodeAgentSnapshot } from "./native-protocol-types/index.js";
|
|
5
|
+
export type { AgentSnapshot } from "./native-protocol-types/index.js";
|
|
6
|
+
export declare function createHostedNativeProvider(provider: 'claude' | 'codex' | 'copilot', executable?: string, codex?: {
|
|
7
|
+
codexConnectionMode?: 'shared' | 'stdio';
|
|
8
|
+
codexSharedSocketPath?: string;
|
|
9
|
+
codexTrustShared?: boolean;
|
|
10
|
+
}): AgentProviderAdapter;
|
|
11
|
+
export declare function configureHostedNativeSession(session: AgentSession, provider: string): Promise<void>;
|
|
12
|
+
export declare const PROTOCOL_VERSION = "1.7.0";
|
|
13
|
+
export declare function isInteractionResponseMessage(value: unknown): value is {
|
|
14
|
+
protocolVersion: string;
|
|
15
|
+
type: 'interaction_response';
|
|
16
|
+
payload: {
|
|
17
|
+
agentId: string;
|
|
18
|
+
requestId: string;
|
|
19
|
+
response: AgentInteractionResponse;
|
|
20
|
+
};
|
|
21
|
+
};
|