@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
|
@@ -61,13 +61,15 @@ class RestartableConnectionsStateStore {
|
|
|
61
61
|
class InMemoryGatewayTokenRegistry {
|
|
62
62
|
resolveBaseUrl;
|
|
63
63
|
tokenFactory;
|
|
64
|
+
resolveStableAgentId;
|
|
64
65
|
activateRollback;
|
|
65
66
|
byChannel = new Map();
|
|
66
67
|
byToken = new Map();
|
|
67
68
|
pendingTokensByChannel = new Map();
|
|
68
|
-
constructor(resolveBaseUrl, tokenFactory, activateRollback = () => { }) {
|
|
69
|
+
constructor(resolveBaseUrl, tokenFactory, resolveStableAgentId, activateRollback = () => { }) {
|
|
69
70
|
this.resolveBaseUrl = resolveBaseUrl;
|
|
70
71
|
this.tokenFactory = tokenFactory;
|
|
72
|
+
this.resolveStableAgentId = resolveStableAgentId;
|
|
71
73
|
this.activateRollback = activateRollback;
|
|
72
74
|
}
|
|
73
75
|
activate() {
|
|
@@ -134,6 +136,7 @@ class InMemoryGatewayTokenRegistry {
|
|
|
134
136
|
const created = {
|
|
135
137
|
channelId,
|
|
136
138
|
token: this.issueUniqueToken(),
|
|
139
|
+
agentId: this.resolveStableAgentId?.()?.trim() || undefined,
|
|
137
140
|
};
|
|
138
141
|
this.byChannel.set(channelId, created);
|
|
139
142
|
this.byToken.set(created.token, created);
|
|
@@ -424,7 +427,7 @@ class LoopbackLocalhostGatewayController {
|
|
|
424
427
|
return;
|
|
425
428
|
}
|
|
426
429
|
case 'files': {
|
|
427
|
-
const files = await this.controlPlane.listChannelFiles({ channelId: binding
|
|
430
|
+
const files = await this.controlPlane.listChannelFiles({ channelId: this.resolveFileScopeChannelId(binding) });
|
|
428
431
|
this.sendJson(response, 200, { files });
|
|
429
432
|
this.recordAudit('authorized', 200, decision.path, request.method ?? 'GET', decision.binding);
|
|
430
433
|
return;
|
|
@@ -437,7 +440,7 @@ class LoopbackLocalhostGatewayController {
|
|
|
437
440
|
}
|
|
438
441
|
validatePortableRelativePath(path);
|
|
439
442
|
const content = await this.controlPlane.readChannelFile({
|
|
440
|
-
channelId: binding
|
|
443
|
+
channelId: this.resolveFileScopeChannelId(binding),
|
|
441
444
|
path,
|
|
442
445
|
textOnly: true,
|
|
443
446
|
});
|
|
@@ -449,7 +452,7 @@ class LoopbackLocalhostGatewayController {
|
|
|
449
452
|
const body = parseFileTransferBody(await readGatewayJsonBody(request));
|
|
450
453
|
const rootPath = requireExecutionRoot(binding.payload ?? {});
|
|
451
454
|
const content = await this.controlPlane.readChannelFile({
|
|
452
|
-
channelId: binding
|
|
455
|
+
channelId: this.resolveFileScopeChannelId(binding),
|
|
453
456
|
path: body.path,
|
|
454
457
|
textOnly: false,
|
|
455
458
|
});
|
|
@@ -464,13 +467,13 @@ class LoopbackLocalhostGatewayController {
|
|
|
464
467
|
case 'file-sync': {
|
|
465
468
|
const body = parseFileSyncBody(await readGatewayJsonBody(request));
|
|
466
469
|
const rootPath = requireExecutionRoot(binding.payload ?? {});
|
|
467
|
-
const entries = (await this.controlPlane.listChannelFiles({ channelId: binding
|
|
470
|
+
const entries = (await this.controlPlane.listChannelFiles({ channelId: this.resolveFileScopeChannelId(binding) }))
|
|
468
471
|
.filter((file) => !file.isDirectory)
|
|
469
472
|
.filter((file) => body.path == null || file.path === body.path || file.path.startsWith(`${body.path}/`));
|
|
470
473
|
const synced = [];
|
|
471
474
|
for (const file of entries) {
|
|
472
475
|
const content = await this.controlPlane.readChannelFile({
|
|
473
|
-
channelId: binding
|
|
476
|
+
channelId: this.resolveFileScopeChannelId(binding),
|
|
474
477
|
path: file.path,
|
|
475
478
|
textOnly: false,
|
|
476
479
|
});
|
|
@@ -496,7 +499,7 @@ class LoopbackLocalhostGatewayController {
|
|
|
496
499
|
}
|
|
497
500
|
const content = await readWorkspaceFile(rootPath, body.sourcePath);
|
|
498
501
|
const file = await this.controlPlane.publishChannelFile({
|
|
499
|
-
channelId: binding
|
|
502
|
+
channelId: this.resolveFileScopeChannelId(binding),
|
|
500
503
|
path: body.channelPath,
|
|
501
504
|
contentType: body.contentType ?? inferContentType(body.sourcePath),
|
|
502
505
|
base64: content.toString('base64'),
|
|
@@ -709,6 +712,12 @@ class LoopbackLocalhostGatewayController {
|
|
|
709
712
|
throw error;
|
|
710
713
|
}
|
|
711
714
|
}
|
|
715
|
+
resolveFileScopeChannelId(binding) {
|
|
716
|
+
const taskChannelId = binding.payload?.taskAssignmentContext?.taskChannelId;
|
|
717
|
+
return typeof taskChannelId === 'string' && taskChannelId.trim().length > 0
|
|
718
|
+
? taskChannelId
|
|
719
|
+
: binding.channelId;
|
|
720
|
+
}
|
|
712
721
|
async loadAuthorizedTask(boundChannelId, route) {
|
|
713
722
|
let task;
|
|
714
723
|
try {
|
|
@@ -1031,7 +1040,23 @@ function mapGatewayControlPlaneError(error, fallbackReason) {
|
|
|
1031
1040
|
case 'bpp.task_not_found':
|
|
1032
1041
|
case 'bpp.channel_not_found':
|
|
1033
1042
|
case 'bpp.guild_not_found':
|
|
1043
|
+
case 'bpp.file_not_found':
|
|
1034
1044
|
return new GatewayHttpError(404, { error: 'not_found' }, 'not-found');
|
|
1045
|
+
case 'bpp.file_invalid':
|
|
1046
|
+
case 'bpp.file_content_invalid':
|
|
1047
|
+
return new GatewayHttpError(400, { error: 'invalid_file_content' }, 'bad-request');
|
|
1048
|
+
case 'bpp.file_input_required':
|
|
1049
|
+
return new GatewayHttpError(422, { error: 'file_input_required' }, 'bad-request');
|
|
1050
|
+
case 'bpp.file_conflict':
|
|
1051
|
+
return new GatewayHttpError(409, { error: 'file_conflict' }, 'conflict');
|
|
1052
|
+
case 'bpp.file_too_large':
|
|
1053
|
+
case 'bpp.file_extracted_content_too_large':
|
|
1054
|
+
return new GatewayHttpError(413, { error: 'file_too_large' }, 'bad-request');
|
|
1055
|
+
case 'bpp.file_unsupported_media_type':
|
|
1056
|
+
case 'bpp.file_extractor_required':
|
|
1057
|
+
return new GatewayHttpError(415, { error: 'file_extractor_required' }, 'bad-request');
|
|
1058
|
+
case 'bpp.file_extraction_failed':
|
|
1059
|
+
return new GatewayHttpError(502, { error: 'file_extraction_failed' }, 'invalid-file-content');
|
|
1035
1060
|
case 'bpp.task_title_required':
|
|
1036
1061
|
return new GatewayHttpError(400, { error: 'title_required' }, 'bad-request');
|
|
1037
1062
|
case 'bpp.task_no_updates':
|
|
@@ -1088,7 +1113,7 @@ export function createLocalhostGatewayController(options) {
|
|
|
1088
1113
|
}
|
|
1089
1114
|
const contextPublisherFactory = (resolveBaseUrl) => {
|
|
1090
1115
|
if (!options.tokenBindingGateEnabled) {
|
|
1091
|
-
return new InMemoryGatewayTokenRegistry(resolveBaseUrl, options.tokenFactory ?? (() => randomUUID()), () => revokeDurableTokenBindingsIfPresent(options.stateRootDir));
|
|
1116
|
+
return new InMemoryGatewayTokenRegistry(resolveBaseUrl, options.tokenFactory ?? (() => randomUUID()), options.resolveStableAgentId, () => revokeDurableTokenBindingsIfPresent(options.stateRootDir));
|
|
1092
1117
|
}
|
|
1093
1118
|
const stateRootDir = options.stateRootDir?.trim();
|
|
1094
1119
|
if (!stateRootDir) {
|
|
@@ -27,7 +27,7 @@ export function buildHostedTurnContentParts(input) {
|
|
|
27
27
|
return parts;
|
|
28
28
|
}
|
|
29
29
|
export function extractHostedMessageAttachments(parts) {
|
|
30
|
-
return parts.flatMap((part) =>
|
|
30
|
+
return parts.flatMap((part) => 'attachment' in part ? [normalizeHostedMessageAttachment(part.attachment)] : []);
|
|
31
31
|
}
|
|
32
32
|
export function buildHostedIncomingContentText(parts) {
|
|
33
33
|
const text = parts
|
|
@@ -42,7 +42,8 @@ export function buildHostedIncomingContentText(parts) {
|
|
|
42
42
|
`[Attachment metadata was received for ${nonTextParts.length} attachment${nonTextParts.length === 1 ? '' : 's'}]`,
|
|
43
43
|
...nonTextParts.map((part, index) => {
|
|
44
44
|
const filename = part.attachment.filename?.trim();
|
|
45
|
-
|
|
45
|
+
const size = part.attachment.sizeBytes;
|
|
46
|
+
return `${index + 1}. ${part.type};${filename ? ` filename: ${filename};` : ''} content type: ${part.attachment.contentType}${size !== undefined ? `; size: ${size} bytes` : ''}`;
|
|
46
47
|
}),
|
|
47
48
|
];
|
|
48
49
|
const summary = summaryLines.join('\n');
|
package/dist/local-config.js
CHANGED
|
@@ -2,7 +2,7 @@ import { promises as fs } from 'node:fs';
|
|
|
2
2
|
import { randomUUID } from 'node:crypto';
|
|
3
3
|
import { dirname, extname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
4
4
|
import { parseDocument, stringify } from 'yaml';
|
|
5
|
-
import { assertProviderCompatibility, assertProviderCommandCompatibility, optionalNonEmptyString, optionalStringArray, parseCopilotSessionTtlMinutesValue, parseBooleanValue, parseProviderIdleShutdownMinutesValue, requireNonEmptyString, resolveProvider, resolveProviderCommandConfig, } from './config.js';
|
|
5
|
+
import { assertProviderCompatibility, assertProviderCommandCompatibility, optionalNonEmptyString, optionalStringArray, parseCopilotSessionTtlMinutesValue, parseBooleanValue, parseProviderIdleShutdownMinutesValue, parseProviderOutputMode, parseCodexConnectionMode, requireNonEmptyString, resolveProvider, resolveProviderCommandConfig, } from './config.js';
|
|
6
6
|
import { resolveLocalConfigAgentStateRoot } from './state-paths.js';
|
|
7
7
|
const SUPPORTED_CONFIG_EXTENSIONS = new Set(['.json', '.yaml', '.yml']);
|
|
8
8
|
export const DEFAULT_LOCAL_HOST_CONFIG_FILENAME = 'agents-host.yaml';
|
|
@@ -107,6 +107,21 @@ function parseProviderCommandOverrides(value, sourceLabel) {
|
|
|
107
107
|
if (claudeArgs !== undefined) {
|
|
108
108
|
overrides.claudeArgs = claudeArgs;
|
|
109
109
|
}
|
|
110
|
+
if (value.providerOutputMode !== undefined)
|
|
111
|
+
overrides.providerOutputMode = parseProviderOutputMode(value.providerOutputMode);
|
|
112
|
+
if (value.codexConnectionMode !== undefined)
|
|
113
|
+
overrides.codexConnectionMode = parseCodexConnectionMode(value.codexConnectionMode);
|
|
114
|
+
const sessionWorkspaceRoot = optionalNonEmptyString(value.sessionWorkspaceRoot, 'sessionWorkspaceRoot', sourceLabel);
|
|
115
|
+
if (sessionWorkspaceRoot !== undefined)
|
|
116
|
+
overrides.sessionWorkspaceRoot = sessionWorkspaceRoot;
|
|
117
|
+
const nativeProviderCommand = optionalNonEmptyString(value.nativeProviderCommand, 'nativeProviderCommand', sourceLabel);
|
|
118
|
+
if (nativeProviderCommand !== undefined)
|
|
119
|
+
overrides.nativeProviderCommand = nativeProviderCommand;
|
|
120
|
+
const codexSharedSocketPath = optionalNonEmptyString(value.codexSharedSocketPath, 'codexSharedSocketPath', sourceLabel);
|
|
121
|
+
if (codexSharedSocketPath !== undefined)
|
|
122
|
+
overrides.codexSharedSocketPath = codexSharedSocketPath;
|
|
123
|
+
if (value.codexTrustShared !== undefined)
|
|
124
|
+
overrides.codexTrustShared = parseBooleanValue(value.codexTrustShared, 'codexTrustShared', sourceLabel);
|
|
110
125
|
const codexCommand = optionalNonEmptyString(value.codexCommand, 'codexCommand', sourceLabel);
|
|
111
126
|
if (codexCommand !== undefined) {
|
|
112
127
|
overrides.codexCommand = codexCommand;
|
|
@@ -688,6 +703,18 @@ function renderAgentConfigYaml(agent) {
|
|
|
688
703
|
if (agent.enabled !== undefined) {
|
|
689
704
|
config.enabled = agent.enabled;
|
|
690
705
|
}
|
|
706
|
+
if (agent.providerOutputMode !== undefined)
|
|
707
|
+
config.providerOutputMode = agent.providerOutputMode;
|
|
708
|
+
if (agent.sessionWorkspaceRoot !== undefined)
|
|
709
|
+
config.sessionWorkspaceRoot = agent.sessionWorkspaceRoot;
|
|
710
|
+
if (agent.nativeProviderCommand !== undefined)
|
|
711
|
+
config.nativeProviderCommand = agent.nativeProviderCommand;
|
|
712
|
+
if (agent.codexConnectionMode !== undefined)
|
|
713
|
+
config.codexConnectionMode = agent.codexConnectionMode;
|
|
714
|
+
if (agent.codexSharedSocketPath !== undefined)
|
|
715
|
+
config.codexSharedSocketPath = agent.codexSharedSocketPath;
|
|
716
|
+
if (agent.codexTrustShared !== undefined)
|
|
717
|
+
config.codexTrustShared = agent.codexTrustShared;
|
|
691
718
|
if (agent.claudeCommand !== undefined) {
|
|
692
719
|
config.claudeCommand = agent.claudeCommand;
|
|
693
720
|
}
|
|
@@ -742,6 +769,12 @@ function buildManagedAgentSnapshot(host, stateRootBaseDir, sourcePath, agent) {
|
|
|
742
769
|
function resolveAgentProviderCommandConfig(hostDefaults, agent) {
|
|
743
770
|
return resolveProviderCommandConfig({
|
|
744
771
|
...hostDefaults,
|
|
772
|
+
...(agent.providerOutputMode !== undefined ? { providerOutputMode: agent.providerOutputMode } : {}),
|
|
773
|
+
...(agent.sessionWorkspaceRoot !== undefined ? { sessionWorkspaceRoot: agent.sessionWorkspaceRoot } : {}),
|
|
774
|
+
...(agent.nativeProviderCommand !== undefined ? { nativeProviderCommand: agent.nativeProviderCommand } : {}),
|
|
775
|
+
...(agent.codexConnectionMode !== undefined ? { codexConnectionMode: agent.codexConnectionMode } : {}),
|
|
776
|
+
...(agent.codexSharedSocketPath !== undefined ? { codexSharedSocketPath: agent.codexSharedSocketPath } : {}),
|
|
777
|
+
...(agent.codexTrustShared !== undefined ? { codexTrustShared: agent.codexTrustShared } : {}),
|
|
745
778
|
...(agent.claudeCommand !== undefined ? { claudeCommand: agent.claudeCommand } : {}),
|
|
746
779
|
...(agent.claudeArgs !== undefined ? { claudeArgs: agent.claudeArgs } : {}),
|
|
747
780
|
...(agent.codexCommand !== undefined ? { codexCommand: agent.codexCommand } : {}),
|
package/dist/managed-daemon.js
CHANGED
|
@@ -351,6 +351,11 @@ export function buildManagedLocalAgentConfig(options) {
|
|
|
351
351
|
apiKey: config.agent.agentApiKey,
|
|
352
352
|
provider: config.agent.provider,
|
|
353
353
|
enabled: true,
|
|
354
|
+
...(config.providerOutputMode !== undefined ? { providerOutputMode: config.providerOutputMode } : {}),
|
|
355
|
+
...(config.nativeProviderCommand !== undefined ? { nativeProviderCommand: config.nativeProviderCommand } : {}),
|
|
356
|
+
...(config.codexConnectionMode !== undefined ? { codexConnectionMode: config.codexConnectionMode } : {}),
|
|
357
|
+
...(config.codexSharedSocketPath !== undefined ? { codexSharedSocketPath: config.codexSharedSocketPath } : {}),
|
|
358
|
+
...(config.codexTrustShared !== undefined ? { codexTrustShared: config.codexTrustShared } : {}),
|
|
354
359
|
claudeCommand: config.claudeCommand,
|
|
355
360
|
claudeArgs: [...config.claudeArgs],
|
|
356
361
|
codexCommand: config.codexCommand,
|
|
@@ -382,6 +387,11 @@ function mergeManagedLocalAgentConfig(hostDefaults, existingAgent, generatedAgen
|
|
|
382
387
|
enabled: true,
|
|
383
388
|
name: hasOverride('BORGEE_AGENT_NAME') ? generatedAgent.name : existingAgent.name,
|
|
384
389
|
provider: hasOverride('RUNTIME_PROVIDER') ? generatedAgent.provider : existingAgent.provider,
|
|
390
|
+
providerOutputMode: hasOverride('PROVIDER_OUTPUT_MODE') ? generatedAgent.providerOutputMode : existingAgent.providerOutputMode,
|
|
391
|
+
nativeProviderCommand: hasOverride('NATIVE_PROVIDER_COMMAND') ? generatedAgent.nativeProviderCommand : existingAgent.nativeProviderCommand,
|
|
392
|
+
codexConnectionMode: hasOverride('CODEX_CONNECTION_MODE') ? generatedAgent.codexConnectionMode : existingAgent.codexConnectionMode,
|
|
393
|
+
codexSharedSocketPath: hasOverride('CODEX_SHARED_SOCKET_PATH') ? generatedAgent.codexSharedSocketPath : existingAgent.codexSharedSocketPath,
|
|
394
|
+
codexTrustShared: hasOverride('CODEX_TRUST_SHARED') ? generatedAgent.codexTrustShared : existingAgent.codexTrustShared,
|
|
385
395
|
claudeCommand: hasOverride('CLAUDE_COMMAND') || shouldRefreshLegacyClaudeDefaults
|
|
386
396
|
? generatedAgent.claudeCommand
|
|
387
397
|
: existingAgent.claudeCommand,
|
|
@@ -416,6 +426,11 @@ function collectExplicitManagedAgentEnvOverrides(processEnv, optionEnv) {
|
|
|
416
426
|
for (const key of [
|
|
417
427
|
'BORGEE_AGENT_NAME',
|
|
418
428
|
'RUNTIME_PROVIDER',
|
|
429
|
+
'PROVIDER_OUTPUT_MODE',
|
|
430
|
+
'NATIVE_PROVIDER_COMMAND',
|
|
431
|
+
'CODEX_CONNECTION_MODE',
|
|
432
|
+
'CODEX_SHARED_SOCKET_PATH',
|
|
433
|
+
'CODEX_TRUST_SHARED',
|
|
419
434
|
'CLAUDE_COMMAND',
|
|
420
435
|
'CLAUDE_ARGS',
|
|
421
436
|
'CODEX_COMMAND',
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Explicit undefined values survive the native adapters' process.env merge. */
|
|
2
|
+
export function filterNativeEnvironment(env) {
|
|
3
|
+
const native = { ...env };
|
|
4
|
+
for (const key of Object.keys(native)) {
|
|
5
|
+
if (/^(?:BORGEE_|AGENT_HOST_|AGENT_REMOTE_|GATEWAY_|RELAY_)/i.test(key))
|
|
6
|
+
native[key] = undefined;
|
|
7
|
+
}
|
|
8
|
+
return native;
|
|
9
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type AgentStreamMessage as AgentStreamMessageValue } from './envelope.js';
|
|
2
|
+
import { type HistoryPage as HistoryPageValue } from './history.js';
|
|
3
|
+
import { type AgentSessionResponse as AgentSessionResponseValue, type ClientMessage as ClientMessageValue, type CommandAcknowledgementMessage as CommandAcknowledgementMessageValue, type CreateAgentRequest as CreateAgentRequestValue, type IncompatibleProtocolVersionErrorMessage as IncompatibleProtocolVersionErrorMessageValue, type ProviderListResponse as ProviderListResponseValue, type ResumeAgentRequest as ResumeAgentRequestValue, type ServerMessage as ServerMessageValue } from './messages.js';
|
|
4
|
+
import { type ResourceResponse as ResourceResponseValue, type ResourceUpdate as ResourceUpdateValue } from './resources.js';
|
|
5
|
+
import { type AgentSnapshot as AgentSnapshotValue } from './snapshot.js';
|
|
6
|
+
export interface WireIssue {
|
|
7
|
+
code: 'invalid_json' | 'invalid_shape' | 'incompatible_protocol_version' | 'not_json_serializable';
|
|
8
|
+
path: string;
|
|
9
|
+
message: string;
|
|
10
|
+
}
|
|
11
|
+
export type WireDecodeResult<T> = {
|
|
12
|
+
status: 'ok';
|
|
13
|
+
value: T;
|
|
14
|
+
} | {
|
|
15
|
+
status: 'rejected';
|
|
16
|
+
issues: WireIssue[];
|
|
17
|
+
};
|
|
18
|
+
export type WireEncodeResult = {
|
|
19
|
+
status: 'ok';
|
|
20
|
+
json: string;
|
|
21
|
+
} | {
|
|
22
|
+
status: 'rejected';
|
|
23
|
+
issues: WireIssue[];
|
|
24
|
+
};
|
|
25
|
+
export declare function decodeAgentSnapshot(json: string): WireDecodeResult<AgentSnapshotValue>;
|
|
26
|
+
export declare function encodeAgentSnapshot(value: AgentSnapshotValue): WireEncodeResult;
|
|
27
|
+
export declare function decodeHistoryPage(json: string): WireDecodeResult<HistoryPageValue>;
|
|
28
|
+
export declare function encodeHistoryPage(value: HistoryPageValue): WireEncodeResult;
|
|
29
|
+
export declare function decodeAgentStreamMessage(json: string): WireDecodeResult<AgentStreamMessageValue>;
|
|
30
|
+
export declare function encodeAgentStreamMessage(value: AgentStreamMessageValue): WireEncodeResult;
|
|
31
|
+
export declare function decodeResourceResponse(json: string): WireDecodeResult<ResourceResponseValue>;
|
|
32
|
+
export declare function encodeResourceResponse(value: ResourceResponseValue): WireEncodeResult;
|
|
33
|
+
export declare function decodeResourceUpdate(json: string): WireDecodeResult<ResourceUpdateValue>;
|
|
34
|
+
export declare function encodeResourceUpdate(value: ResourceUpdateValue): WireEncodeResult;
|
|
35
|
+
export declare function decodeCreateAgentRequest(json: string): WireDecodeResult<CreateAgentRequestValue>;
|
|
36
|
+
export declare function encodeCreateAgentRequest(value: CreateAgentRequestValue): WireEncodeResult;
|
|
37
|
+
export declare function decodeResumeAgentRequest(json: string): WireDecodeResult<ResumeAgentRequestValue>;
|
|
38
|
+
export declare function encodeResumeAgentRequest(value: ResumeAgentRequestValue): WireEncodeResult;
|
|
39
|
+
export declare function decodeAgentSessionResponse(json: string): WireDecodeResult<AgentSessionResponseValue>;
|
|
40
|
+
export declare function encodeAgentSessionResponse(value: AgentSessionResponseValue): WireEncodeResult;
|
|
41
|
+
export declare function decodeProviderListResponse(json: string): WireDecodeResult<ProviderListResponseValue>;
|
|
42
|
+
export declare function encodeProviderListResponse(value: ProviderListResponseValue): WireEncodeResult;
|
|
43
|
+
export declare function decodeCommandAcknowledgementMessage(json: string): WireDecodeResult<CommandAcknowledgementMessageValue>;
|
|
44
|
+
export declare function encodeCommandAcknowledgementMessage(value: CommandAcknowledgementMessageValue): WireEncodeResult;
|
|
45
|
+
export declare function decodeClientMessage(json: string): WireDecodeResult<ClientMessageValue>;
|
|
46
|
+
export declare function encodeClientMessage(value: ClientMessageValue): WireEncodeResult;
|
|
47
|
+
export declare function decodeServerMessage(json: string): WireDecodeResult<ServerMessageValue>;
|
|
48
|
+
export declare function decodeIncompatibleProtocolVersionError(json: string): WireDecodeResult<IncompatibleProtocolVersionErrorMessageValue>;
|
|
49
|
+
export declare function encodeServerMessage(value: ServerMessageValue): WireEncodeResult;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type Static } from '@sinclair/typebox';
|
|
2
|
+
export declare const AgentCommand: import("@sinclair/typebox").TObject<{
|
|
3
|
+
id: import("@sinclair/typebox").TString;
|
|
4
|
+
name: import("@sinclair/typebox").TString;
|
|
5
|
+
description: import("@sinclair/typebox").TString;
|
|
6
|
+
kind: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"command">, import("@sinclair/typebox").TLiteral<"skill">, import("@sinclair/typebox").TLiteral<"prompt">]>;
|
|
7
|
+
inputHint: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
8
|
+
shortDescription: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
9
|
+
documentation: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
10
|
+
locator: import("@sinclair/typebox").TString;
|
|
11
|
+
resourceId: import("@sinclair/typebox").TString;
|
|
12
|
+
status: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"pending">, import("@sinclair/typebox").TLiteral<"available">, import("@sinclair/typebox").TLiteral<"failed">, import("@sinclair/typebox").TLiteral<"unavailable">]>;
|
|
13
|
+
}>>;
|
|
14
|
+
}>;
|
|
15
|
+
export type AgentCommand = Static<typeof AgentCommand>;
|
|
16
|
+
export declare const AgentCommandResult: import("@sinclair/typebox").TObject<{
|
|
17
|
+
text: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
18
|
+
}>;
|
|
19
|
+
export type AgentCommandResult = Static<typeof AgentCommandResult>;
|
|
20
|
+
export declare const ListCommandsRequest: import("@sinclair/typebox").TObject<{
|
|
21
|
+
protocolVersion: import("@sinclair/typebox").TLiteral<"1.7.0">;
|
|
22
|
+
type: import("@sinclair/typebox").TLiteral<"list_commands">;
|
|
23
|
+
payload: import("@sinclair/typebox").TObject<{
|
|
24
|
+
requestId: import("@sinclair/typebox").TString;
|
|
25
|
+
agentId: import("@sinclair/typebox").TString;
|
|
26
|
+
}>;
|
|
27
|
+
}>;
|
|
28
|
+
export declare const CommandListResponse: import("@sinclair/typebox").TObject<{
|
|
29
|
+
protocolVersion: import("@sinclair/typebox").TLiteral<"1.7.0">;
|
|
30
|
+
type: import("@sinclair/typebox").TLiteral<"command_list">;
|
|
31
|
+
payload: import("@sinclair/typebox").TObject<{
|
|
32
|
+
commands: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
33
|
+
id: import("@sinclair/typebox").TString;
|
|
34
|
+
name: import("@sinclair/typebox").TString;
|
|
35
|
+
description: import("@sinclair/typebox").TString;
|
|
36
|
+
kind: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"command">, import("@sinclair/typebox").TLiteral<"skill">, import("@sinclair/typebox").TLiteral<"prompt">]>;
|
|
37
|
+
inputHint: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
38
|
+
shortDescription: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
39
|
+
documentation: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
40
|
+
locator: import("@sinclair/typebox").TString;
|
|
41
|
+
resourceId: import("@sinclair/typebox").TString;
|
|
42
|
+
status: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"pending">, import("@sinclair/typebox").TLiteral<"available">, import("@sinclair/typebox").TLiteral<"failed">, import("@sinclair/typebox").TLiteral<"unavailable">]>;
|
|
43
|
+
}>>;
|
|
44
|
+
}>>;
|
|
45
|
+
requestId: import("@sinclair/typebox").TString;
|
|
46
|
+
agentId: import("@sinclair/typebox").TString;
|
|
47
|
+
}>;
|
|
48
|
+
}>;
|
|
49
|
+
export type CommandListResponse = Static<typeof CommandListResponse>;
|
|
50
|
+
export declare const ExecuteCommandRequest: import("@sinclair/typebox").TObject<{
|
|
51
|
+
protocolVersion: import("@sinclair/typebox").TLiteral<"1.7.0">;
|
|
52
|
+
type: import("@sinclair/typebox").TLiteral<"execute_command">;
|
|
53
|
+
payload: import("@sinclair/typebox").TObject<{
|
|
54
|
+
commandId: import("@sinclair/typebox").TString;
|
|
55
|
+
args: import("@sinclair/typebox").TString;
|
|
56
|
+
requestId: import("@sinclair/typebox").TString;
|
|
57
|
+
agentId: import("@sinclair/typebox").TString;
|
|
58
|
+
}>;
|
|
59
|
+
}>;
|
|
60
|
+
export declare const CommandResultResponse: import("@sinclair/typebox").TObject<{
|
|
61
|
+
protocolVersion: import("@sinclair/typebox").TLiteral<"1.7.0">;
|
|
62
|
+
type: import("@sinclair/typebox").TLiteral<"command_result">;
|
|
63
|
+
payload: import("@sinclair/typebox").TObject<{
|
|
64
|
+
result: import("@sinclair/typebox").TObject<{
|
|
65
|
+
text: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
66
|
+
}>;
|
|
67
|
+
requestId: import("@sinclair/typebox").TString;
|
|
68
|
+
agentId: import("@sinclair/typebox").TString;
|
|
69
|
+
}>;
|
|
70
|
+
}>;
|
|
71
|
+
export type CommandResultResponse = Static<typeof CommandResultResponse>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PROTOCOL_VERSION } from './version.js';
|
|
2
|
+
export type NormalizedProtocolVersion = typeof PROTOCOL_VERSION | '1.6.0' | '1.5.0' | '1.4.0' | '1.1.0';
|
|
3
|
+
export declare function isSupportedNormalizedVersion(version: unknown): version is NormalizedProtocolVersion;
|
|
4
|
+
/** Validate committed bytes in their declared schema before adapting a projection copy. */
|
|
5
|
+
export declare function validateNormalizedEventVersion(version: string, event: unknown): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Static } from '@sinclair/typebox';
|
|
2
|
+
export declare const SafeNonNegativeInteger: import("@sinclair/typebox").TInteger;
|
|
3
|
+
export declare const TimelineCursor: import("@sinclair/typebox").TObject<{
|
|
4
|
+
epoch: import("@sinclair/typebox").TString;
|
|
5
|
+
seq: import("@sinclair/typebox").TInteger;
|
|
6
|
+
}>;
|
|
7
|
+
export type TimelineCursor = Static<typeof TimelineCursor>;
|