@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,26 @@
|
|
|
1
|
+
import { type Static } from '@sinclair/typebox';
|
|
2
|
+
export declare const AgentToolResultJson: import("@sinclair/typebox").TRecursive<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TNull, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TThis>, import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TThis>]>>;
|
|
3
|
+
export type AgentToolResultJson = Static<typeof AgentToolResultJson>;
|
|
4
|
+
export declare const AgentToolResultContent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
5
|
+
type: import("@sinclair/typebox").TLiteral<"text">;
|
|
6
|
+
text: import("@sinclair/typebox").TString;
|
|
7
|
+
stream: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"stdout">, import("@sinclair/typebox").TLiteral<"stderr">, import("@sinclair/typebox").TLiteral<"combined">]>>;
|
|
8
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
9
|
+
type: import("@sinclair/typebox").TLiteral<"json">;
|
|
10
|
+
value: import("@sinclair/typebox").TRecursive<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TNull, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TThis>, import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TThis>]>>;
|
|
11
|
+
}>]>;
|
|
12
|
+
export type AgentToolResultContent = Static<typeof AgentToolResultContent>;
|
|
13
|
+
export declare const AgentToolResult: import("@sinclair/typebox").TObject<{
|
|
14
|
+
content: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
15
|
+
type: import("@sinclair/typebox").TLiteral<"text">;
|
|
16
|
+
text: import("@sinclair/typebox").TString;
|
|
17
|
+
stream: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"stdout">, import("@sinclair/typebox").TLiteral<"stderr">, import("@sinclair/typebox").TLiteral<"combined">]>>;
|
|
18
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
19
|
+
type: import("@sinclair/typebox").TLiteral<"json">;
|
|
20
|
+
value: import("@sinclair/typebox").TRecursive<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TNull, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TThis>, import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TThis>]>>;
|
|
21
|
+
}>]>>;
|
|
22
|
+
exitCode: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
23
|
+
durationMs: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
24
|
+
truncated: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
25
|
+
}>;
|
|
26
|
+
export type AgentToolResult = Static<typeof AgentToolResult>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type Static } from '@sinclair/typebox';
|
|
2
|
+
import type { WireDecodeResult, WireEncodeResult } from './codec.js';
|
|
3
|
+
export declare const UPLINK_VERSION = 1;
|
|
4
|
+
export declare const UPLINK_MAX_FRAME_BYTES: number;
|
|
5
|
+
export declare const UPLINK_MAX_PUBLIC_REQUEST_BYTES: number;
|
|
6
|
+
export declare const UplinkMessage: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
7
|
+
uplinkVersion: import("@sinclair/typebox").TLiteral<1>;
|
|
8
|
+
type: import("@sinclair/typebox").TLiteral<"register">;
|
|
9
|
+
agentId: import("@sinclair/typebox").TString;
|
|
10
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
11
|
+
uplinkVersion: import("@sinclair/typebox").TLiteral<1>;
|
|
12
|
+
type: import("@sinclair/typebox").TLiteral<"registered">;
|
|
13
|
+
agentId: import("@sinclair/typebox").TString;
|
|
14
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
15
|
+
type: import("@sinclair/typebox").TLiteral<"rpc_request">;
|
|
16
|
+
method: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"GET">, import("@sinclair/typebox").TLiteral<"POST">]>;
|
|
17
|
+
path: import("@sinclair/typebox").TString;
|
|
18
|
+
body: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
19
|
+
uplinkVersion: import("@sinclair/typebox").TLiteral<1>;
|
|
20
|
+
requestId: import("@sinclair/typebox").TString;
|
|
21
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
22
|
+
type: import("@sinclair/typebox").TLiteral<"rpc_response">;
|
|
23
|
+
status: import("@sinclair/typebox").TInteger;
|
|
24
|
+
body: import("@sinclair/typebox").TString;
|
|
25
|
+
uplinkVersion: import("@sinclair/typebox").TLiteral<1>;
|
|
26
|
+
requestId: import("@sinclair/typebox").TString;
|
|
27
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
28
|
+
type: import("@sinclair/typebox").TLiteral<"rpc_cancel">;
|
|
29
|
+
uplinkVersion: import("@sinclair/typebox").TLiteral<1>;
|
|
30
|
+
requestId: import("@sinclair/typebox").TString;
|
|
31
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
32
|
+
type: import("@sinclair/typebox").TLiteral<"stream_open">;
|
|
33
|
+
uplinkVersion: import("@sinclair/typebox").TLiteral<1>;
|
|
34
|
+
streamId: import("@sinclair/typebox").TString;
|
|
35
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
36
|
+
type: import("@sinclair/typebox").TLiteral<"stream_opened">;
|
|
37
|
+
uplinkVersion: import("@sinclair/typebox").TLiteral<1>;
|
|
38
|
+
streamId: import("@sinclair/typebox").TString;
|
|
39
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
40
|
+
type: import("@sinclair/typebox").TLiteral<"stream_message">;
|
|
41
|
+
message: import("@sinclair/typebox").TString;
|
|
42
|
+
uplinkVersion: import("@sinclair/typebox").TLiteral<1>;
|
|
43
|
+
streamId: import("@sinclair/typebox").TString;
|
|
44
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
45
|
+
type: import("@sinclair/typebox").TLiteral<"stream_close">;
|
|
46
|
+
code: import("@sinclair/typebox").TUnion<[...import("@sinclair/typebox").TLiteral<number>[], import("@sinclair/typebox").TInteger]>;
|
|
47
|
+
reason: import("@sinclair/typebox").TString;
|
|
48
|
+
uplinkVersion: import("@sinclair/typebox").TLiteral<1>;
|
|
49
|
+
streamId: import("@sinclair/typebox").TString;
|
|
50
|
+
}>]>;
|
|
51
|
+
export type UplinkMessage = Static<typeof UplinkMessage>;
|
|
52
|
+
export type UplinkBrokerMessage = Extract<UplinkMessage, {
|
|
53
|
+
type: 'registered' | 'rpc_request' | 'rpc_cancel' | 'stream_open' | 'stream_message' | 'stream_close';
|
|
54
|
+
}>;
|
|
55
|
+
export declare function decodeUplinkMessage(json: string): WireDecodeResult<UplinkMessage>;
|
|
56
|
+
export declare function encodeUplinkMessage(value: UplinkMessage): WireEncodeResult;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type Static } from '@sinclair/typebox';
|
|
2
|
+
export declare const BORGEE_AGENT_REMOTE_PROTOCOL_VERSION = "1.7.0";
|
|
3
|
+
export declare const PROTOCOL_VERSION = "1.7.0";
|
|
4
|
+
export declare const ProtocolVersionSchema: import("@sinclair/typebox").TLiteral<"1.7.0">;
|
|
5
|
+
export type ProtocolVersionSchema = Static<typeof ProtocolVersionSchema>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { AgentInteractionRequest, AgentInteractionResponse } from './control.js';
|
|
2
|
+
import type { AgentStreamEvent } from './observation.js';
|
|
3
|
+
export interface AgentCommand {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
kind: 'command' | 'skill' | 'prompt';
|
|
8
|
+
inputHint?: string;
|
|
9
|
+
shortDescription?: string;
|
|
10
|
+
/** Provider-owned resource locator for read-only command documentation. */
|
|
11
|
+
documentation?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface AgentCommandResult {
|
|
14
|
+
text?: string;
|
|
15
|
+
/** This invocation admitted native turn work; completion remains on observe(). */
|
|
16
|
+
execution?: 'turn';
|
|
17
|
+
/** Turn identity returned by the native transport. */
|
|
18
|
+
turnId?: string;
|
|
19
|
+
/** Actual native input protocol identity, including caller-assigned message IDs. */
|
|
20
|
+
messageId?: string;
|
|
21
|
+
}
|
|
22
|
+
/** The invocation was rejected before any native side effect or turn admission. */
|
|
23
|
+
export declare class AgentCommandRejectedError extends Error {
|
|
24
|
+
constructor(message: string);
|
|
25
|
+
}
|
|
26
|
+
export declare function validateCommandDirectory(commands: AgentCommand[]): AgentCommand[];
|
|
27
|
+
type CommandRequest = Omit<Extract<AgentInteractionRequest, {
|
|
28
|
+
kind: 'question';
|
|
29
|
+
}>, 'requestId'> | Omit<Extract<AgentInteractionRequest, {
|
|
30
|
+
kind: 'form';
|
|
31
|
+
}>, 'requestId'>;
|
|
32
|
+
interface PendingCommandInteraction {
|
|
33
|
+
request: AgentInteractionRequest;
|
|
34
|
+
handler(response: AgentInteractionResponse): Promise<void>;
|
|
35
|
+
submitting: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** Command menus share the same response validation and events as native interactions. */
|
|
38
|
+
export declare class CommandInteractions {
|
|
39
|
+
private readonly provider;
|
|
40
|
+
private readonly emit;
|
|
41
|
+
private readonly requests;
|
|
42
|
+
private readonly prefix;
|
|
43
|
+
private sequence;
|
|
44
|
+
constructor(provider: string, emit: (event: AgentStreamEvent) => void);
|
|
45
|
+
get pending(): boolean;
|
|
46
|
+
pendingInteractions(): AgentInteractionRequest[];
|
|
47
|
+
open(request: CommandRequest, handler: PendingCommandInteraction['handler']): string;
|
|
48
|
+
respond(requestId: string, response: AgentInteractionResponse): Promise<boolean>;
|
|
49
|
+
clear(): void;
|
|
50
|
+
}
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
export type AgentPlanAction = 'approve' | 'approve_and_resume' | 'reject';
|
|
2
|
+
export type AgentToolDecision = 'allow' | 'deny' | 'cancel';
|
|
3
|
+
export type AgentToolApprovalScope = 'once' | 'session' | 'policy';
|
|
4
|
+
export type AgentToolDetail = {
|
|
5
|
+
type: 'shell';
|
|
6
|
+
command: string;
|
|
7
|
+
cwd?: string;
|
|
8
|
+
} | {
|
|
9
|
+
type: 'read';
|
|
10
|
+
filePath: string;
|
|
11
|
+
} | {
|
|
12
|
+
type: 'edit';
|
|
13
|
+
filePath: string;
|
|
14
|
+
} | {
|
|
15
|
+
type: 'write';
|
|
16
|
+
filePath: string;
|
|
17
|
+
} | {
|
|
18
|
+
type: 'search';
|
|
19
|
+
query: string;
|
|
20
|
+
} | {
|
|
21
|
+
type: 'fetch';
|
|
22
|
+
url: string;
|
|
23
|
+
} | {
|
|
24
|
+
type: 'other';
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
export interface AgentQuestionOption {
|
|
28
|
+
value: string;
|
|
29
|
+
label: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface AgentQuestion {
|
|
33
|
+
questionId: string;
|
|
34
|
+
header: string;
|
|
35
|
+
prompt: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
required: boolean;
|
|
38
|
+
selection: 'single' | 'multiple';
|
|
39
|
+
options: AgentQuestionOption[];
|
|
40
|
+
allowCustomText: boolean;
|
|
41
|
+
allowDismiss: boolean;
|
|
42
|
+
sensitive?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface AgentFormOption {
|
|
45
|
+
value: string;
|
|
46
|
+
label: string;
|
|
47
|
+
}
|
|
48
|
+
interface AgentFormFieldBase {
|
|
49
|
+
fieldId: string;
|
|
50
|
+
label: string;
|
|
51
|
+
required: boolean;
|
|
52
|
+
description?: string;
|
|
53
|
+
sensitive?: boolean;
|
|
54
|
+
}
|
|
55
|
+
export type AgentFormField = AgentFormFieldBase & ({
|
|
56
|
+
type: 'text';
|
|
57
|
+
minLength?: number;
|
|
58
|
+
maxLength?: number;
|
|
59
|
+
format?: 'email' | 'uri' | 'date' | 'date-time';
|
|
60
|
+
defaultValue?: string;
|
|
61
|
+
} | {
|
|
62
|
+
type: 'number';
|
|
63
|
+
integer?: boolean;
|
|
64
|
+
minimum?: number;
|
|
65
|
+
maximum?: number;
|
|
66
|
+
defaultValue?: number;
|
|
67
|
+
} | {
|
|
68
|
+
type: 'boolean';
|
|
69
|
+
defaultValue?: boolean;
|
|
70
|
+
} | {
|
|
71
|
+
type: 'select';
|
|
72
|
+
options: AgentFormOption[];
|
|
73
|
+
defaultValue?: string;
|
|
74
|
+
} | {
|
|
75
|
+
type: 'multiselect';
|
|
76
|
+
options: AgentFormOption[];
|
|
77
|
+
minItems?: number;
|
|
78
|
+
maxItems?: number;
|
|
79
|
+
defaultValue?: string[];
|
|
80
|
+
});
|
|
81
|
+
export type AgentFormValue = string | number | boolean | string[];
|
|
82
|
+
export type AgentFormValues = Record<string, AgentFormValue>;
|
|
83
|
+
export type AgentPermissionScope = 'turn' | 'session';
|
|
84
|
+
export interface AgentPermission {
|
|
85
|
+
resource: 'filesystem' | 'network';
|
|
86
|
+
access: 'read' | 'write' | 'deny' | 'connect';
|
|
87
|
+
target: string;
|
|
88
|
+
}
|
|
89
|
+
export type AgentInteractionRequest = {
|
|
90
|
+
kind: 'question';
|
|
91
|
+
requestId: string;
|
|
92
|
+
questions: AgentQuestion[];
|
|
93
|
+
} | {
|
|
94
|
+
kind: 'plan_approval';
|
|
95
|
+
requestId: string;
|
|
96
|
+
plan: string;
|
|
97
|
+
allowedActions: AgentPlanAction[];
|
|
98
|
+
} | {
|
|
99
|
+
kind: 'tool_approval';
|
|
100
|
+
requestId: string;
|
|
101
|
+
toolCallId: string;
|
|
102
|
+
toolName: string;
|
|
103
|
+
summary: string;
|
|
104
|
+
detail: AgentToolDetail;
|
|
105
|
+
allowedDecisions: AgentToolDecision[];
|
|
106
|
+
allowScopes: AgentToolApprovalScope[];
|
|
107
|
+
policies?: {
|
|
108
|
+
policyId: string;
|
|
109
|
+
description: string;
|
|
110
|
+
}[];
|
|
111
|
+
context?: {
|
|
112
|
+
label: string;
|
|
113
|
+
value: string;
|
|
114
|
+
}[];
|
|
115
|
+
} | {
|
|
116
|
+
kind: 'form';
|
|
117
|
+
requestId: string;
|
|
118
|
+
title: string;
|
|
119
|
+
message: string;
|
|
120
|
+
fields: AgentFormField[];
|
|
121
|
+
} | {
|
|
122
|
+
kind: 'permission_approval';
|
|
123
|
+
requestId: string;
|
|
124
|
+
summary: string;
|
|
125
|
+
permissions: AgentPermission[];
|
|
126
|
+
allowScopes: AgentPermissionScope[];
|
|
127
|
+
} | {
|
|
128
|
+
kind: 'external_action';
|
|
129
|
+
requestId: string;
|
|
130
|
+
title: string;
|
|
131
|
+
message: string;
|
|
132
|
+
url: string;
|
|
133
|
+
};
|
|
134
|
+
export interface AgentQuestionAnswer {
|
|
135
|
+
questionId: string;
|
|
136
|
+
selectedValues: string[];
|
|
137
|
+
customText?: string;
|
|
138
|
+
redacted?: boolean;
|
|
139
|
+
}
|
|
140
|
+
/** Answers are ordinary visible user input, not a pending tool response. */
|
|
141
|
+
export interface AgentQuestionnaireResponse {
|
|
142
|
+
messageId: string;
|
|
143
|
+
answers: AgentQuestionAnswer[];
|
|
144
|
+
}
|
|
145
|
+
/** Asynchronous questionnaires do not provide sensitive-input handling. */
|
|
146
|
+
export type AgentQuestionnaireQuestion = Omit<AgentQuestion, 'sensitive'> & {
|
|
147
|
+
sensitive?: false;
|
|
148
|
+
};
|
|
149
|
+
export type AgentInteractionResponse = {
|
|
150
|
+
kind: 'question';
|
|
151
|
+
answers: AgentQuestionAnswer[];
|
|
152
|
+
dismissed?: boolean;
|
|
153
|
+
} | {
|
|
154
|
+
kind: 'plan_approval';
|
|
155
|
+
action: 'approve' | 'approve_and_resume';
|
|
156
|
+
} | {
|
|
157
|
+
kind: 'plan_approval';
|
|
158
|
+
action: 'reject';
|
|
159
|
+
feedback?: string;
|
|
160
|
+
} | {
|
|
161
|
+
kind: 'tool_approval';
|
|
162
|
+
decision: 'allow';
|
|
163
|
+
scope: 'once' | 'session';
|
|
164
|
+
} | {
|
|
165
|
+
kind: 'tool_approval';
|
|
166
|
+
decision: 'allow';
|
|
167
|
+
scope: 'policy';
|
|
168
|
+
policyId: string;
|
|
169
|
+
} | {
|
|
170
|
+
kind: 'tool_approval';
|
|
171
|
+
decision: 'deny' | 'cancel';
|
|
172
|
+
message?: string;
|
|
173
|
+
} | {
|
|
174
|
+
kind: 'form';
|
|
175
|
+
action: 'submit';
|
|
176
|
+
values: AgentFormValues;
|
|
177
|
+
redactedFields?: string[];
|
|
178
|
+
} | {
|
|
179
|
+
kind: 'form';
|
|
180
|
+
action: 'decline' | 'cancel';
|
|
181
|
+
} | {
|
|
182
|
+
kind: 'permission_approval';
|
|
183
|
+
decision: 'allow';
|
|
184
|
+
scope: AgentPermissionScope;
|
|
185
|
+
} | {
|
|
186
|
+
kind: 'permission_approval';
|
|
187
|
+
decision: 'deny';
|
|
188
|
+
} | {
|
|
189
|
+
kind: 'external_action';
|
|
190
|
+
action: 'completed' | 'decline' | 'cancel';
|
|
191
|
+
};
|
|
192
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type AgentToolResult } from './tool-result.js';
|
|
2
|
+
export interface AgentFileChange {
|
|
3
|
+
path: string;
|
|
4
|
+
kind: 'added' | 'modified' | 'deleted' | 'renamed' | 'unknown';
|
|
5
|
+
previousPath?: string;
|
|
6
|
+
diff: string;
|
|
7
|
+
}
|
|
8
|
+
/** A versioned presentation format within the existing JSON result channel. */
|
|
9
|
+
export declare function fileChangesResult(files: AgentFileChange[]): AgentToolResult;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './control.js';
|
|
2
|
+
export * from './interactions.js';
|
|
3
|
+
export * from './observation.js';
|
|
4
|
+
export * from './provider.js';
|
|
5
|
+
export * from './tool-result.js';
|
|
6
|
+
export * from './file-changes.js';
|
|
7
|
+
export * from './session-settings.js';
|
|
8
|
+
export * from './commands.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AgentInteractionRequest, AgentInteractionResponse } from './control.js';
|
|
2
|
+
/** Validates a command against exactly the choices displayed by its pending request. */
|
|
3
|
+
export declare function validateInteractionResponse(request: AgentInteractionRequest, response: AgentInteractionResponse): void;
|
|
4
|
+
/** Produces a detached public request without publishing sensitive field defaults. */
|
|
5
|
+
export declare function redactInteractionRequest(request: AgentInteractionRequest): AgentInteractionRequest;
|
|
6
|
+
/** Produces a detached historical receipt; sensitive values belong only in the provider command. */
|
|
7
|
+
export declare function redactInteractionResponse(request: AgentInteractionRequest, response: AgentInteractionResponse): AgentInteractionResponse;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import type { AgentToolResult } from './tool-result.js';
|
|
2
|
+
import type { AgentInteractionRequest, AgentInteractionResponse, AgentQuestionnaireQuestion, AgentQuestionnaireResponse, AgentToolDetail } from './control.js';
|
|
3
|
+
export interface AgentTaskItem {
|
|
4
|
+
text: string;
|
|
5
|
+
completed: boolean;
|
|
6
|
+
id?: string;
|
|
7
|
+
status?: 'pending' | 'in_progress' | 'completed';
|
|
8
|
+
activeForm?: string;
|
|
9
|
+
}
|
|
10
|
+
interface AgentToolCallBase {
|
|
11
|
+
type: 'tool_call';
|
|
12
|
+
callId: string;
|
|
13
|
+
name: string;
|
|
14
|
+
detail: AgentToolDetail;
|
|
15
|
+
result?: AgentToolResult;
|
|
16
|
+
}
|
|
17
|
+
export type AgentToolCallTimelineItem = AgentToolCallBase & ({
|
|
18
|
+
status: 'running';
|
|
19
|
+
error: null;
|
|
20
|
+
} | {
|
|
21
|
+
status: 'completed';
|
|
22
|
+
error: null;
|
|
23
|
+
} | {
|
|
24
|
+
status: 'failed';
|
|
25
|
+
error: string;
|
|
26
|
+
} | {
|
|
27
|
+
status: 'canceled';
|
|
28
|
+
error: null;
|
|
29
|
+
});
|
|
30
|
+
export type AgentTimelineItem = {
|
|
31
|
+
type: 'user_message';
|
|
32
|
+
text: string;
|
|
33
|
+
messageId?: string;
|
|
34
|
+
clientMessageId?: string;
|
|
35
|
+
origin?: {
|
|
36
|
+
kind: 'borgee' | 'native' | 'agent' | 'unknown';
|
|
37
|
+
};
|
|
38
|
+
questionnaireResponse?: AgentQuestionnaireResponse;
|
|
39
|
+
} | {
|
|
40
|
+
type: 'assistant_message';
|
|
41
|
+
text: string;
|
|
42
|
+
messageId?: string;
|
|
43
|
+
} | {
|
|
44
|
+
type: 'questionnaire';
|
|
45
|
+
messageId: string;
|
|
46
|
+
text: string;
|
|
47
|
+
questions: AgentQuestionnaireQuestion[];
|
|
48
|
+
} | {
|
|
49
|
+
type: 'reasoning';
|
|
50
|
+
text: string;
|
|
51
|
+
} | AgentToolCallTimelineItem | {
|
|
52
|
+
type: 'todo';
|
|
53
|
+
items: AgentTaskItem[];
|
|
54
|
+
} | {
|
|
55
|
+
type: 'interaction';
|
|
56
|
+
request: AgentInteractionRequest;
|
|
57
|
+
response: AgentInteractionResponse;
|
|
58
|
+
} | {
|
|
59
|
+
type: 'error';
|
|
60
|
+
message: string;
|
|
61
|
+
} | {
|
|
62
|
+
type: 'compaction';
|
|
63
|
+
status: 'loading' | 'completed';
|
|
64
|
+
trigger?: 'auto' | 'manual';
|
|
65
|
+
preTokens?: number;
|
|
66
|
+
};
|
|
67
|
+
/** An immutable, settled delta. Token buckets are disjoint; input excludes cache. */
|
|
68
|
+
export interface AgentUsageAccounting {
|
|
69
|
+
measurementId: string;
|
|
70
|
+
scope: 'turn' | 'llm_call';
|
|
71
|
+
provider: string;
|
|
72
|
+
model: string;
|
|
73
|
+
inputTokens: number;
|
|
74
|
+
outputTokens: number;
|
|
75
|
+
cacheReadTokens: number;
|
|
76
|
+
cacheWriteTokens: number;
|
|
77
|
+
}
|
|
78
|
+
export interface AgentUsage {
|
|
79
|
+
/** Absent when turn attribution or required counters cannot be proven; unknown API routes use provider "unknown". */
|
|
80
|
+
accounting?: AgentUsageAccounting[];
|
|
81
|
+
inputTokens?: number;
|
|
82
|
+
cachedInputTokens?: number;
|
|
83
|
+
outputTokens?: number;
|
|
84
|
+
totalCostUsd?: number;
|
|
85
|
+
contextWindowMaxTokens?: number;
|
|
86
|
+
contextWindowUsedTokens?: number;
|
|
87
|
+
}
|
|
88
|
+
export interface AgentPlanningState {
|
|
89
|
+
active: boolean;
|
|
90
|
+
requested?: boolean;
|
|
91
|
+
}
|
|
92
|
+
/** A direct native child, with stable creation provenance when the runtime provides it. */
|
|
93
|
+
export interface AgentChildSession {
|
|
94
|
+
nativeSessionId: string;
|
|
95
|
+
title: string;
|
|
96
|
+
role?: string;
|
|
97
|
+
description?: string;
|
|
98
|
+
createdAt: string;
|
|
99
|
+
parentTurnId?: string;
|
|
100
|
+
parentCallId?: string;
|
|
101
|
+
status: 'starting' | 'idle' | 'running' | 'waiting' | 'failed' | 'closed';
|
|
102
|
+
observation: 'live' | 'saved_history';
|
|
103
|
+
}
|
|
104
|
+
export interface AgentRuntimeInfo {
|
|
105
|
+
providerId: string;
|
|
106
|
+
sessionId: string | null;
|
|
107
|
+
status: 'starting' | 'idle' | 'running' | 'waiting' | 'failed' | 'closed';
|
|
108
|
+
cwd?: string;
|
|
109
|
+
model?: string | null;
|
|
110
|
+
mode?: string | null;
|
|
111
|
+
planning?: AgentPlanningState;
|
|
112
|
+
settings?: import('./session-settings.js').AgentSessionSetting[];
|
|
113
|
+
childSessions?: AgentChildSession[];
|
|
114
|
+
persistence?: import('./provider.js').AgentPersistenceHandle;
|
|
115
|
+
}
|
|
116
|
+
export type AgentStreamEvent = {
|
|
117
|
+
type: 'thread_started';
|
|
118
|
+
sessionId: string;
|
|
119
|
+
provider: string;
|
|
120
|
+
} | {
|
|
121
|
+
type: 'turn_started';
|
|
122
|
+
provider: string;
|
|
123
|
+
turnId?: string;
|
|
124
|
+
} | {
|
|
125
|
+
type: 'turn_completed';
|
|
126
|
+
provider: string;
|
|
127
|
+
usage?: AgentUsage;
|
|
128
|
+
turnId?: string;
|
|
129
|
+
} | {
|
|
130
|
+
type: 'turn_failed';
|
|
131
|
+
provider: string;
|
|
132
|
+
error: string;
|
|
133
|
+
code?: string;
|
|
134
|
+
diagnostic?: string;
|
|
135
|
+
turnId?: string;
|
|
136
|
+
} | {
|
|
137
|
+
type: 'turn_canceled';
|
|
138
|
+
provider: string;
|
|
139
|
+
reason: string;
|
|
140
|
+
turnId?: string;
|
|
141
|
+
} | {
|
|
142
|
+
type: 'timeline';
|
|
143
|
+
provider: string;
|
|
144
|
+
item: AgentTimelineItem;
|
|
145
|
+
turnId?: string;
|
|
146
|
+
} | {
|
|
147
|
+
type: 'usage_updated';
|
|
148
|
+
provider: string;
|
|
149
|
+
usage: AgentUsage;
|
|
150
|
+
turnId?: string;
|
|
151
|
+
} | {
|
|
152
|
+
type: 'runtime_updated';
|
|
153
|
+
provider: string;
|
|
154
|
+
runtimeInfo: AgentRuntimeInfo;
|
|
155
|
+
} | {
|
|
156
|
+
type: 'interaction_requested';
|
|
157
|
+
provider: string;
|
|
158
|
+
request: AgentInteractionRequest;
|
|
159
|
+
turnId?: string;
|
|
160
|
+
} | {
|
|
161
|
+
type: 'interaction_resolved';
|
|
162
|
+
provider: string;
|
|
163
|
+
requestId: string;
|
|
164
|
+
response: AgentInteractionResponse;
|
|
165
|
+
turnId?: string;
|
|
166
|
+
};
|
|
167
|
+
export interface ProviderResourceReference {
|
|
168
|
+
locator: string;
|
|
169
|
+
readLocator: string;
|
|
170
|
+
}
|
|
171
|
+
export interface ProviderObservation {
|
|
172
|
+
type: 'observation';
|
|
173
|
+
sourceKey: string;
|
|
174
|
+
occurredAt: number;
|
|
175
|
+
nativeRevision?: number;
|
|
176
|
+
delivery: 'history' | 'live';
|
|
177
|
+
event: AgentStreamEvent;
|
|
178
|
+
resourceReferences?: ProviderResourceReference[];
|
|
179
|
+
}
|
|
180
|
+
/** Ends historical delivery; complete-state providers establish authority with a following session_restored. */
|
|
181
|
+
export interface ProviderHistoryBoundary {
|
|
182
|
+
type: 'history_boundary';
|
|
183
|
+
}
|
|
184
|
+
/** Complete, ordered Timeline correction after readiness. Runtime state is unaffected. */
|
|
185
|
+
export interface ProviderTimelineReplacement {
|
|
186
|
+
type: 'timeline_replacement';
|
|
187
|
+
observations: ProviderObservation[];
|
|
188
|
+
}
|
|
189
|
+
/** Retires connection-owned interactions without changing native execution or capabilities. */
|
|
190
|
+
export interface ProviderSessionInvalidated {
|
|
191
|
+
type: 'session_invalidated';
|
|
192
|
+
recovery: 'retrying' | 'stopped';
|
|
193
|
+
/** Bounded provider reason code, never a raw native diagnostic. */
|
|
194
|
+
reason: string;
|
|
195
|
+
}
|
|
196
|
+
/** Atomic complete native state and ordered history evidence on initial attachment or restoration of the same Session. */
|
|
197
|
+
export interface ProviderSessionRestored {
|
|
198
|
+
type: 'session_restored';
|
|
199
|
+
runtimeInfo: AgentRuntimeInfo;
|
|
200
|
+
capabilities: import('./provider.js').AgentCapabilities;
|
|
201
|
+
activeTurn: {
|
|
202
|
+
turnId: string;
|
|
203
|
+
startedAt?: string;
|
|
204
|
+
} | null;
|
|
205
|
+
pendingInteractions: AgentInteractionRequest[];
|
|
206
|
+
observations: ProviderObservation[];
|
|
207
|
+
}
|
|
208
|
+
export type ProviderStreamItem = ProviderObservation | ProviderHistoryBoundary | ProviderTimelineReplacement | ProviderSessionInvalidated | ProviderSessionRestored;
|
|
209
|
+
export {};
|