@borgee/agents-host 0.2.97 → 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 +16 -0
- package/dist/agents-host.js +608 -82
- package/dist/catalog-worker.js +21 -0
- package/dist/catalog-worker.js.map +7 -0
- package/dist/chat/chat-control-plane.d.ts +19 -4
- 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 +46 -6
- package/dist/chat/sdk-chat-control-plane.js +169 -6
- 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/skill-manual.js +1 -1
- package/dist/context/turn-preparation.d.ts +2 -1
- package/dist/context/turn-preparation.js +15 -0
- package/dist/execution-telemetry.d.ts +96 -0
- package/dist/execution-telemetry.js +583 -0
- package/dist/gateway/channel-file-workspace.d.ts +15 -0
- package/dist/gateway/channel-file-workspace.js +130 -0
- package/dist/gateway/localhost-gateway.js +167 -2
- 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 +10713 -229
- package/dist/plugin-sdk.js.map +4 -4
- package/dist/policy/copilot-permission.js +1 -8
- package/dist/policy/gateway-authorization.d.ts +1 -1
- package/dist/policy/gateway-authorization.js +22 -2
- package/dist/providers/claude/adapter.js +1 -0
- package/dist/providers/claude/cli-client.js +4 -0
- package/dist/providers/codex/adapter.js +1 -0
- package/dist/providers/codex/cli-client.js +5 -0
- package/dist/providers/copilot/adapter.js +4 -0
- package/dist/providers/copilot/cli-client.js +11 -1
- package/dist/providers/copilot/sdk-session.d.ts +12 -3
- package/dist/providers/copilot/sdk-session.js +230 -6
- package/dist/providers/create-provider.js +24 -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/prompt-usage.d.ts +8 -0
- package/dist/providers/prompt-usage.js +52 -0
- package/dist/providers/provider-adapter.d.ts +43 -1
- package/dist/providers/provider-adapter.js +8 -0
- package/dist/state-paths.d.ts +2 -0
- package/dist/state-paths.js +6 -0
- package/dist/types.d.ts +66 -0
- package/dist/typing-lease.d.ts +14 -0
- package/dist/typing-lease.js +31 -0
- 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 +12 -4
- package/skills/borgee-agent/scripts/borgee-agent.mjs +110 -0
- package/skills/borgee-agent/scripts/borgee-agent.py +116 -0
|
@@ -216,9 +216,14 @@ function sanitizeTaskAssignmentContext(value) {
|
|
|
216
216
|
const currentTaskId = typeof value.currentTaskId === 'string'
|
|
217
217
|
? value.currentTaskId.trim()
|
|
218
218
|
: '';
|
|
219
|
-
|
|
220
|
-
?
|
|
221
|
-
:
|
|
219
|
+
const taskChannelId = typeof value.taskChannelId === 'string'
|
|
220
|
+
? value.taskChannelId.trim()
|
|
221
|
+
: '';
|
|
222
|
+
return {
|
|
223
|
+
active: true,
|
|
224
|
+
...(currentTaskId && isUsableTaskId(currentTaskId) ? { currentTaskId } : {}),
|
|
225
|
+
...(taskChannelId.length > 0 ? { taskChannelId } : {}),
|
|
226
|
+
};
|
|
222
227
|
}
|
|
223
228
|
export function extractTaskIdFromTaskAssignmentContent(incomingContent) {
|
|
224
229
|
if (typeof incomingContent !== 'string') {
|
|
@@ -232,7 +237,11 @@ export function extractTaskIdFromTaskAssignmentContent(incomingContent) {
|
|
|
232
237
|
function buildTaskAssignmentContextForTurn(options, existingContext) {
|
|
233
238
|
if (options?.incomingMessageType === 'task_assignment') {
|
|
234
239
|
const currentTaskId = extractTaskIdFromTaskAssignmentContent(options.incomingContent);
|
|
235
|
-
return
|
|
240
|
+
return {
|
|
241
|
+
active: true,
|
|
242
|
+
...(existingContext?.taskChannelId ? { taskChannelId: existingContext.taskChannelId } : {}),
|
|
243
|
+
...(currentTaskId ? { currentTaskId } : {}),
|
|
244
|
+
};
|
|
236
245
|
}
|
|
237
246
|
return existingContext;
|
|
238
247
|
}
|
|
@@ -352,7 +361,10 @@ async function resolveTaskThreadWorkingFolderContext(params) {
|
|
|
352
361
|
};
|
|
353
362
|
}
|
|
354
363
|
return {
|
|
355
|
-
taskAssignmentContext
|
|
364
|
+
taskAssignmentContext: {
|
|
365
|
+
...taskAssignmentContext,
|
|
366
|
+
taskChannelId: task.channelId,
|
|
367
|
+
},
|
|
356
368
|
resolvedWorkingFolder: {
|
|
357
369
|
authority: 'task-execution-target',
|
|
358
370
|
taskId: task.id,
|
|
@@ -535,9 +547,11 @@ export class FileChannelContextStore {
|
|
|
535
547
|
const collaborationCommandsEnabled = input.collaboration?.enabled === true && input.collaboration.sendRoutesAllowed === true;
|
|
536
548
|
const collaborationRoutesAllowedForTurnMode = turnMode === 'ordinary';
|
|
537
549
|
const auxiliaryCollaborationEnabled = collaborationCommandsEnabled && collaborationRoutesAllowedForTurnMode;
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
const
|
|
550
|
+
const contextRoot = input.independentSessionWorkspace
|
|
551
|
+
? join(this.stateRootDir, 'session-context', encodeURIComponent(input.independentSessionWorkspace.bindingId)) : this.stateRootDir;
|
|
552
|
+
const directoryPath = resolveChannelContextDirectory(contextRoot, input.channelId);
|
|
553
|
+
const payloadPath = resolveChannelContextPayloadPath(contextRoot, input.channelId);
|
|
554
|
+
const taskAssignmentStatePath = resolveTaskAssignmentStatePath(contextRoot, input.channelId);
|
|
541
555
|
const claudeProjectedBriefPath = resolveClaudeProjectedBriefPathFromPayloadPath(payloadPath);
|
|
542
556
|
const gatewayCredentialPath = resolveGatewayCredentialPathFromPayloadPath(payloadPath);
|
|
543
557
|
const existingTaskAssignmentContext = await readExistingTaskAssignmentContext(taskAssignmentStatePath, this.fileSystem);
|
|
@@ -571,16 +585,18 @@ export class FileChannelContextStore {
|
|
|
571
585
|
incomingMessageType: input.incomingMessageType,
|
|
572
586
|
incomingContent: input.incomingContent,
|
|
573
587
|
}, existingTaskAssignmentContext);
|
|
574
|
-
const workingFolderResolution =
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
588
|
+
const workingFolderResolution = input.independentSessionWorkspace
|
|
589
|
+
? { resolvedWorkingFolder: { authority: 'channel', owningChannelId: input.channelId, rootPath: input.independentSessionWorkspace.cwd }, taskAssignmentContext }
|
|
590
|
+
: await resolveTaskThreadWorkingFolderContext({
|
|
591
|
+
channelId: input.channelId,
|
|
592
|
+
workingFolderCollectionRootDir: this.workingFolderCollectionRootDir,
|
|
593
|
+
taskAssignmentContext,
|
|
594
|
+
taskReader: this.taskReader,
|
|
595
|
+
taskResolutionTimeoutMs: this.taskResolutionTimeoutMs,
|
|
596
|
+
allowCrossAgentIndependentWorkspaceHandoff: this.allowCrossAgentIndependentWorkspaceHandoff,
|
|
597
|
+
resolveStableAgentId: this.resolveStableAgentId,
|
|
598
|
+
fileSystem: this.fileSystem,
|
|
599
|
+
});
|
|
584
600
|
const resolvedWorkingFolder = workingFolderResolution.resolvedWorkingFolder;
|
|
585
601
|
const runtimeTaskAssignmentContext = workingFolderResolution.taskAssignmentContext ?? taskAssignmentContext;
|
|
586
602
|
const persistedTaskAssignmentContext = input.taskAssignmentContextOverridePersistence === 'ephemeral'
|
|
@@ -625,8 +641,8 @@ export class FileChannelContextStore {
|
|
|
625
641
|
}
|
|
626
642
|
try {
|
|
627
643
|
await this.fileSystem.mkdir(directoryPath, { recursive: true, mode: 0o700 });
|
|
628
|
-
await this.fileSystem.mkdir(resolveTaskAssignmentStateDirectory(
|
|
629
|
-
if (resolvedWorkingFolder.authority !== 'task-execution-target') {
|
|
644
|
+
await this.fileSystem.mkdir(resolveTaskAssignmentStateDirectory(contextRoot, input.channelId), { recursive: true, mode: 0o700 });
|
|
645
|
+
if (!input.independentSessionWorkspace && resolvedWorkingFolder.authority !== 'task-execution-target') {
|
|
630
646
|
await this.fileSystem.mkdir(resolvedWorkingFolder.rootPath, { recursive: true, mode: 0o700 });
|
|
631
647
|
}
|
|
632
648
|
await pruneGatewayCredentialSidecars(this.fileSystem, directoryPath, gatewayCredential ? CHANNEL_GATEWAY_CREDENTIAL_FILENAME : undefined);
|
|
@@ -636,7 +652,7 @@ export class FileChannelContextStore {
|
|
|
636
652
|
await this.fileSystem.writeFile(payloadPath, `${JSON.stringify(payload, null, 2)}\n`, { encoding: 'utf8', mode: 0o600 });
|
|
637
653
|
payloadWritten = true;
|
|
638
654
|
if (persistedTaskAssignmentContext) {
|
|
639
|
-
const stagingTaskAssignmentStatePath = join(resolveTaskAssignmentStateDirectory(
|
|
655
|
+
const stagingTaskAssignmentStatePath = join(resolveTaskAssignmentStateDirectory(contextRoot, input.channelId), `.task-assignment-state.${randomUUID()}.json`);
|
|
640
656
|
await this.fileSystem.writeFile(stagingTaskAssignmentStatePath, `${JSON.stringify({ taskAssignmentContext: persistedTaskAssignmentContext }, null, 2)}\n`, { encoding: 'utf8', mode: 0o600 });
|
|
641
657
|
await this.fileSystem.rename(stagingTaskAssignmentStatePath, taskAssignmentStatePath);
|
|
642
658
|
}
|
package/dist/context/prompt.d.ts
CHANGED
|
@@ -31,3 +31,15 @@ export declare function buildClaudeTurnPrompt(params: {
|
|
|
31
31
|
promptContext?: PreparedPromptContext;
|
|
32
32
|
promptStrategy?: ProjectionStrategy;
|
|
33
33
|
}): string;
|
|
34
|
+
/** Native context keys are stable; Codex owns deduplication and conversation history. */
|
|
35
|
+
export declare function buildCodexTurnContext(params: {
|
|
36
|
+
agentName: string;
|
|
37
|
+
channelId: string;
|
|
38
|
+
incomingAuthorId: string;
|
|
39
|
+
incomingEventKind?: string;
|
|
40
|
+
incomingMessageType?: string;
|
|
41
|
+
promptContext?: PreparedPromptContext;
|
|
42
|
+
}): Record<string, {
|
|
43
|
+
kind: 'application' | 'untrusted';
|
|
44
|
+
value: string;
|
|
45
|
+
}>;
|
package/dist/context/prompt.js
CHANGED
|
@@ -681,3 +681,28 @@ export function buildClaudeTurnPrompt(params) {
|
|
|
681
681
|
}),
|
|
682
682
|
].join('\n');
|
|
683
683
|
}
|
|
684
|
+
/** Native context keys are stable; Codex owns deduplication and conversation history. */
|
|
685
|
+
export function buildCodexTurnContext(params) {
|
|
686
|
+
const context = params.promptContext;
|
|
687
|
+
const provider = 'codex';
|
|
688
|
+
// Dynamic context can contain peer/user-authored names and summaries. Keep its original user trust level.
|
|
689
|
+
const blocks = {
|
|
690
|
+
borgee_identity: { kind: 'application', value: [
|
|
691
|
+
...buildPromptHeaderLines({ agentName: params.agentName, provider }),
|
|
692
|
+
...buildSessionDelegationPromptLines(provider, context),
|
|
693
|
+
buildProviderIdentityReminderLine(provider),
|
|
694
|
+
...(context?.skillRuntime ? buildSkillManualLines(context.skillRuntime) : []),
|
|
695
|
+
].join('\n') },
|
|
696
|
+
borgee_control: { kind: 'untrusted', value: buildTurnControlPromptLines(context).join('\n') },
|
|
697
|
+
borgee_metadata: { kind: 'untrusted', value: [
|
|
698
|
+
`Channel: ${params.channelId}`, `Incoming author: ${params.incomingAuthorId}`,
|
|
699
|
+
...buildInboundMetadataLines({ ...params, provider }),
|
|
700
|
+
].join('\n') },
|
|
701
|
+
borgee_outcome: { kind: 'untrusted', value: buildCollaborationOutcomeSummaryLines(context?.collaborationOutcome).join('\n') },
|
|
702
|
+
borgee_attention: { kind: 'untrusted', value: buildAttentionSummaryLines(context?.attentionSnapshot).join('\n') },
|
|
703
|
+
borgee_capabilities: { kind: 'untrusted', value: buildCollaborationCapabilityDeclarationSummaryLines(context?.collaborationCapabilities).join('\n') },
|
|
704
|
+
borgee_diagnostic: { kind: 'untrusted', value: buildMissedCollaborationDiagnosticSummaryLines(context?.missedCollaborationDiagnostic).join('\n') },
|
|
705
|
+
borgee_gateway: { kind: 'untrusted', value: buildLocalhostGatewayPromptLines(context).join('\n') },
|
|
706
|
+
};
|
|
707
|
+
return blocks;
|
|
708
|
+
}
|
|
@@ -14,7 +14,7 @@ export function buildSkillManualReadLine(skillRuntime) {
|
|
|
14
14
|
*/
|
|
15
15
|
export function buildSkillManualLines(skillRuntime) {
|
|
16
16
|
return [
|
|
17
|
-
"A packaged local CLI reads this Borgee channel and acts on its tasks: channel history, visible participants, this channel's tasks and their properties, and short auxiliary mentions.",
|
|
17
|
+
"A packaged local CLI reads this Borgee channel and acts on its tasks: channel history, channel files, visible participants, this channel's tasks and their properties, and short auxiliary mentions.",
|
|
18
18
|
buildSkillManualReadLine(skillRuntime),
|
|
19
19
|
'Every command the manual documents is already authorized on a turn whose prompt names a gateway credential file. Run them directly and do not ask the user for permission first.',
|
|
20
20
|
];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DebugLogger } from '../debug.js';
|
|
2
|
-
import type { ProjectionStrategy, PreparedProviderTurnInput, ProviderInput } from '../types.js';
|
|
2
|
+
import type { ProjectionStrategy, PreparedPromptContext, PreparedProviderTurnInput, ProviderInput } from '../types.js';
|
|
3
3
|
import { type ChannelContextStore } from './injection.js';
|
|
4
4
|
type ResolveProjectionStrategy = (input: ProviderInput) => Promise<ProjectionStrategy>;
|
|
5
5
|
export declare class ProviderTurnPreparer {
|
|
@@ -10,6 +10,7 @@ export declare class ProviderTurnPreparer {
|
|
|
10
10
|
projectionStrategy?: ProjectionStrategy;
|
|
11
11
|
resolveProjectionStrategy?: ResolveProjectionStrategy;
|
|
12
12
|
});
|
|
13
|
+
prepareSession(channelId: string, provider: ProviderInput['provider']): Promise<PreparedPromptContext | undefined>;
|
|
13
14
|
prepare(input: ProviderInput): Promise<PreparedProviderTurnInput>;
|
|
14
15
|
}
|
|
15
16
|
export {};
|
|
@@ -89,6 +89,17 @@ export class ProviderTurnPreparer {
|
|
|
89
89
|
this.resolveProjectionStrategy = options.resolveProjectionStrategy
|
|
90
90
|
?? (async () => options.projectionStrategy ?? DEFAULT_PROJECTION_STRATEGY);
|
|
91
91
|
}
|
|
92
|
+
async prepareSession(channelId, provider) {
|
|
93
|
+
const context = await this.channelContextStore?.prepare({ channelId, provider });
|
|
94
|
+
if (!context)
|
|
95
|
+
return undefined;
|
|
96
|
+
return {
|
|
97
|
+
channelContextPayloadPath: context.payloadPath,
|
|
98
|
+
claudeProjectedBriefPath: context.claudeProjectedBriefPath,
|
|
99
|
+
gatewayCredentialPath: context.gatewayCredentialPath,
|
|
100
|
+
resolvedWorkingFolder: context.resolvedWorkingFolder,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
92
103
|
async prepare(input) {
|
|
93
104
|
const incomingParts = input.incomingParts ?? buildHostedTurnContentParts({
|
|
94
105
|
text: input.incomingContent,
|
|
@@ -100,10 +111,12 @@ export class ProviderTurnPreparer {
|
|
|
100
111
|
? await this.resolveProjectionStrategy(input)
|
|
101
112
|
: undefined;
|
|
102
113
|
let channelContext;
|
|
114
|
+
let contextPreparationFailed = false;
|
|
103
115
|
if (this.channelContextStore) {
|
|
104
116
|
try {
|
|
105
117
|
const prepareInput = {
|
|
106
118
|
channelId: input.channelId,
|
|
119
|
+
...(input.independentSessionWorkspace ? { independentSessionWorkspace: input.independentSessionWorkspace } : {}),
|
|
107
120
|
provider: input.provider,
|
|
108
121
|
projectionStrategy,
|
|
109
122
|
collaboration: input.collaboration
|
|
@@ -139,6 +152,7 @@ export class ProviderTurnPreparer {
|
|
|
139
152
|
channelContext = await this.channelContextStore.prepare(prepareInput);
|
|
140
153
|
}
|
|
141
154
|
catch (error) {
|
|
155
|
+
contextPreparationFailed = true;
|
|
142
156
|
if (error instanceof ChannelContextPreparationError) {
|
|
143
157
|
channelContext = error.partialContext;
|
|
144
158
|
}
|
|
@@ -154,6 +168,7 @@ export class ProviderTurnPreparer {
|
|
|
154
168
|
channelId: input.channelId,
|
|
155
169
|
incomingContent,
|
|
156
170
|
incomingParts,
|
|
171
|
+
...(contextPreparationFailed ? { contextPreparationFailed: true } : {}),
|
|
157
172
|
incomingEventKind: input.incomingEventKind,
|
|
158
173
|
incomingMessageType: input.incomingMessageType,
|
|
159
174
|
prompt: input.provider === 'claude'
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { ExecutionGrant, ExecutionTelemetryFrame } from './plugin-sdk.js';
|
|
2
|
+
import type { ProviderKind, ProviderTokenUsage } from './types.js';
|
|
3
|
+
export interface ExecutionTelemetrySink {
|
|
4
|
+
reportExecutionTelemetry(frame: ExecutionTelemetryFrame): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export interface StoredExecutionUsage extends ProviderTokenUsage {
|
|
7
|
+
provider: ProviderKind;
|
|
8
|
+
}
|
|
9
|
+
export type ExecutionDeliveryClaim = 'new' | 'recovering' | 'completed';
|
|
10
|
+
export declare class ExecutionDeliveryJournal {
|
|
11
|
+
private readonly path?;
|
|
12
|
+
private readonly maxCompletedEntries;
|
|
13
|
+
private readonly now;
|
|
14
|
+
private entries;
|
|
15
|
+
private loaded;
|
|
16
|
+
private writeQueue;
|
|
17
|
+
constructor(path?: string | undefined, maxCompletedEntries?: number, now?: () => number);
|
|
18
|
+
load(): Promise<void>;
|
|
19
|
+
claim(executionId: string): Promise<ExecutionDeliveryClaim>;
|
|
20
|
+
complete(executionId: string): Promise<void>;
|
|
21
|
+
recordUsage(executionId: string, usage: StoredExecutionUsage): Promise<void>;
|
|
22
|
+
readUsage(executionId: string): Promise<StoredExecutionUsage | undefined>;
|
|
23
|
+
private mutate;
|
|
24
|
+
private isStoredExecutionDelivery;
|
|
25
|
+
private isStoredExecutionUsage;
|
|
26
|
+
}
|
|
27
|
+
export declare class ExecutionTelemetryReporter {
|
|
28
|
+
private readonly grant;
|
|
29
|
+
private readonly sink;
|
|
30
|
+
private readonly now;
|
|
31
|
+
private readonly persistUsage?;
|
|
32
|
+
private started;
|
|
33
|
+
private finished;
|
|
34
|
+
private attemptCount;
|
|
35
|
+
private attemptsSucceeded;
|
|
36
|
+
private provider;
|
|
37
|
+
private pendingUsage;
|
|
38
|
+
private usageFrameDurable;
|
|
39
|
+
private usagePersistence;
|
|
40
|
+
private readonly continuations;
|
|
41
|
+
private finishing?;
|
|
42
|
+
get startFrameDurable(): boolean;
|
|
43
|
+
get terminalFrameDurable(): boolean;
|
|
44
|
+
get allRequiredFramesDurable(): boolean;
|
|
45
|
+
constructor(grant: ExecutionGrant, sink: ExecutionTelemetrySink, now?: () => number, persistUsage?: ((provider: ProviderKind, usage: ProviderTokenUsage) => Promise<void>) | undefined);
|
|
46
|
+
start(): Promise<void>;
|
|
47
|
+
usage(provider: ProviderKind, usage: ProviderTokenUsage): Promise<void>;
|
|
48
|
+
noteAttempt(succeeded: boolean): void;
|
|
49
|
+
noteFailure(): void;
|
|
50
|
+
hold(completion: Promise<boolean>): void;
|
|
51
|
+
finish(succeeded?: boolean): Promise<void>;
|
|
52
|
+
private finalize;
|
|
53
|
+
}
|
|
54
|
+
export interface ExecutionTelemetryOutboxPolicy {
|
|
55
|
+
maxEntries: number;
|
|
56
|
+
maxAttempts: number;
|
|
57
|
+
retentionMs: number;
|
|
58
|
+
retryIntervalMs: number;
|
|
59
|
+
}
|
|
60
|
+
export declare class ExecutionTelemetryOutboxCapacityError extends Error {
|
|
61
|
+
constructor();
|
|
62
|
+
}
|
|
63
|
+
type ExecutionTelemetryOutboxOptions = {
|
|
64
|
+
now?: () => number;
|
|
65
|
+
onRetired?: (count: number) => void;
|
|
66
|
+
policy?: Partial<ExecutionTelemetryOutboxPolicy>;
|
|
67
|
+
};
|
|
68
|
+
export declare class ExecutionTelemetryOutbox {
|
|
69
|
+
private readonly path?;
|
|
70
|
+
private frames;
|
|
71
|
+
private loaded;
|
|
72
|
+
private writeQueue;
|
|
73
|
+
private flushInFlight?;
|
|
74
|
+
private readonly now;
|
|
75
|
+
private readonly onRetired?;
|
|
76
|
+
private readonly policy;
|
|
77
|
+
private readonly capacityWaiters;
|
|
78
|
+
constructor(path?: string | undefined, options?: ExecutionTelemetryOutboxOptions);
|
|
79
|
+
load(): Promise<void>;
|
|
80
|
+
enqueue(frame: ExecutionTelemetryFrame): Promise<void>;
|
|
81
|
+
acknowledge(eventId: string): Promise<void>;
|
|
82
|
+
flush(send: (frame: ExecutionTelemetryFrame) => void, force?: boolean): Promise<void>;
|
|
83
|
+
private flushOnce;
|
|
84
|
+
settle(): Promise<void>;
|
|
85
|
+
pendingCount(): number;
|
|
86
|
+
nextRetryDelayMs(): number | undefined;
|
|
87
|
+
hasCapacity(): boolean;
|
|
88
|
+
waitForCapacity(timeoutMs: number): Promise<boolean>;
|
|
89
|
+
private retireExpired;
|
|
90
|
+
private mutate;
|
|
91
|
+
private persist;
|
|
92
|
+
private frameTimestamp;
|
|
93
|
+
private isStoredEntry;
|
|
94
|
+
private notifyCapacityAvailable;
|
|
95
|
+
}
|
|
96
|
+
export {};
|