agent-afk 5.295.9 → 5.296.0
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/dist/agent/hooks/command-executor.d.ts +2 -0
- package/dist/agent/hooks/config-loader.d.ts +3 -1
- package/dist/agent/hooks/config-loader.plugin-hooks.d.ts +17 -0
- package/dist/agent/memory/memory-gc-sweep.d.ts +19 -0
- package/dist/agent/plugins/index-store.d.ts +3 -0
- package/dist/agent/plugins/plugin-user-config.d.ts +12 -0
- package/dist/agent/tools/types.d.ts +1 -0
- package/dist/agent/usage/burn-rate.d.ts +14 -0
- package/dist/agent/usage/usage-ledger.d.ts +2 -1
- package/dist/agent/usage/usage-record.d.ts +8 -0
- package/dist/cli/quota-indicator.d.ts +4 -0
- package/dist/cli.mjs +447 -435
- package/dist/config/env.d.ts +28 -0
- package/dist/config/env.memory-gc.d.ts +17 -0
- package/dist/config/env.paths.d.ts +12 -0
- package/dist/index.mjs +171 -164
- package/dist/paths.d.ts +1 -6
- package/dist/paths.plugins.d.ts +7 -0
- package/dist/telegram.mjs +215 -208
- package/package.json +1 -1
|
@@ -9,6 +9,8 @@ export interface ExecuteCommandOptions {
|
|
|
9
9
|
pluginName?: string;
|
|
10
10
|
pluginHookEnv?: Record<string, string[]>;
|
|
11
11
|
transcriptPath?: string | null;
|
|
12
|
+
pluginOptions?: Record<string, string>;
|
|
13
|
+
pluginKey?: string;
|
|
12
14
|
}
|
|
13
15
|
export interface CommandExecutorResult {
|
|
14
16
|
decision: HookDecision;
|
|
@@ -19,6 +19,7 @@ export interface ResolvedCommandHook {
|
|
|
19
19
|
timeoutMs: number;
|
|
20
20
|
pluginRoot?: string;
|
|
21
21
|
pluginName?: string;
|
|
22
|
+
pluginKey?: string;
|
|
22
23
|
}
|
|
23
24
|
export interface ResolvedMatcherGroup {
|
|
24
25
|
matcher?: string;
|
|
@@ -46,11 +47,12 @@ interface SingleFileResult {
|
|
|
46
47
|
sources: string[];
|
|
47
48
|
warnings: string[];
|
|
48
49
|
}
|
|
49
|
-
export declare function loadHooksConfigFile(path: string, tier: 'user-global' | 'project-local' | 'plugin', pluginRoot?: string, pluginName?: string | null): SingleFileResult;
|
|
50
|
+
export declare function loadHooksConfigFile(path: string, tier: 'user-global' | 'project-local' | 'plugin', pluginRoot?: string, pluginName?: string | null, pluginKey?: string | null): SingleFileResult;
|
|
50
51
|
export declare function discoverPluginHooksConfigs(pluginsRoot?: string): Array<{
|
|
51
52
|
path: string;
|
|
52
53
|
pluginRoot: string;
|
|
53
54
|
pluginName: string | null;
|
|
55
|
+
pluginKey: string | null;
|
|
54
56
|
}>;
|
|
55
57
|
export interface LoadHooksConfigOptions {
|
|
56
58
|
cwd?: string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { HarnessHookEvent } from '../hooks.js';
|
|
2
|
+
import type { ResolvedHooksConfig } from './config-loader.js';
|
|
3
|
+
interface LoadPluginHookConfigsOptions {
|
|
4
|
+
pluginConfigs: Array<{
|
|
5
|
+
path: string;
|
|
6
|
+
pluginRoot: string;
|
|
7
|
+
pluginName: string | null;
|
|
8
|
+
pluginKey: string | null;
|
|
9
|
+
}>;
|
|
10
|
+
pluginHooksEnabled: boolean;
|
|
11
|
+
validEvents: HarnessHookEvent[];
|
|
12
|
+
merged: ResolvedHooksConfig;
|
|
13
|
+
allSources: string[];
|
|
14
|
+
allWarnings: string[];
|
|
15
|
+
}
|
|
16
|
+
export declare function loadPluginHookConfigs(opts: LoadPluginHookConfigsOptions): void;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FactCategory } from './types.js';
|
|
2
|
+
export declare const MEMORY_GC_MIN_AGE_DAYS_DEFAULT = 90;
|
|
3
|
+
export declare const MEMORY_GC_SWEEP_MIN_INTERVAL_MS: number;
|
|
4
|
+
export declare const MEMORY_GC_SWEEP_START_DELAY_MS = 7000;
|
|
5
|
+
export declare const MEMORY_ACCESS_TRACKING_STARTED_AT = "2026-09-23T00:00:00.000Z";
|
|
6
|
+
export declare const GC_EXCLUDED_CATEGORIES: ReadonlySet<FactCategory>;
|
|
7
|
+
export interface MemoryGcSweepOptions {
|
|
8
|
+
memoryDir?: string;
|
|
9
|
+
minAgeDays?: number;
|
|
10
|
+
force?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface MemoryGcSweepResult {
|
|
13
|
+
skipped: boolean;
|
|
14
|
+
skipReason?: 'disabled' | 'too-soon' | 'no-db';
|
|
15
|
+
candidates: number;
|
|
16
|
+
archived: number;
|
|
17
|
+
error?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function sweepMemoryGc(options?: MemoryGcSweepOptions): Promise<MemoryGcSweepResult>;
|
|
@@ -10,6 +10,7 @@ export interface PluginIndexEntry {
|
|
|
10
10
|
updatedAt: string;
|
|
11
11
|
manifestName?: string;
|
|
12
12
|
marketplace?: string;
|
|
13
|
+
options?: Record<string, string>;
|
|
13
14
|
}
|
|
14
15
|
export interface MarketplaceIndexEntry {
|
|
15
16
|
source: string;
|
|
@@ -34,3 +35,5 @@ export declare function upsertMarketplace(name: string, entry: MarketplaceIndexE
|
|
|
34
35
|
export declare function removeMarketplace(name: string, path?: string): PluginIndex;
|
|
35
36
|
export declare function isPinnedRef(entry: Pick<PluginIndexEntry, 'ref' | 'pinnedRef'>, defaultBranch: string): boolean;
|
|
36
37
|
export declare function isMarketplacePinnedRef(entry: Pick<MarketplaceIndexEntry, 'ref' | 'pinnedRef'>, defaultBranch: string): boolean;
|
|
38
|
+
export declare function setPluginOption(name: string, key: string, value: string, path?: string): PluginIndex;
|
|
39
|
+
export declare function unsetPluginOption(name: string, key: string, path?: string): PluginIndex;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface UserConfigField {
|
|
2
|
+
type?: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
default?: string;
|
|
5
|
+
sensitive?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export type UserConfigSchema = Record<string, UserConfigField>;
|
|
8
|
+
export type PluginOptionEnv = Record<string, string>;
|
|
9
|
+
export declare function normaliseOptionKey(key: string): string;
|
|
10
|
+
export declare function readUserConfigSchema(dir: string): UserConfigSchema;
|
|
11
|
+
export declare function buildOptionEnv(schema: UserConfigSchema, stored: Record<string, string> | undefined): PluginOptionEnv;
|
|
12
|
+
export declare function validateOptionKey(key: string, schema: UserConfigSchema): 'ok' | string;
|
|
@@ -9,6 +9,7 @@ import type { UserAttention } from './user-yield.js';
|
|
|
9
9
|
import type { DetachableToolRegistry } from './detach-registry.js';
|
|
10
10
|
export interface ToolHandlerContext {
|
|
11
11
|
resolveBase?: string;
|
|
12
|
+
cwd?: string;
|
|
12
13
|
readRoots?: string[];
|
|
13
14
|
writeRoots?: string[];
|
|
14
15
|
env?: Record<string, string>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface WindowObservationSample {
|
|
2
|
+
readonly observedAt: number;
|
|
3
|
+
readonly utilization: number;
|
|
4
|
+
readonly resetsAt?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const MIN_SAMPLES = 3;
|
|
7
|
+
export declare const MAX_SAMPLE_AGE_MS: number;
|
|
8
|
+
export interface BurnRateProjection {
|
|
9
|
+
readonly capsAtMs: number;
|
|
10
|
+
readonly ratePerMs: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function computeBurnRate(samples: readonly WindowObservationSample[], now: number, resetsAt?: number): BurnRateProjection | null;
|
|
13
|
+
export declare const RING_SIZE: number;
|
|
14
|
+
export declare function appendSample(ring: readonly WindowObservationSample[], sample: WindowObservationSample): WindowObservationSample[];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { type PerMinuteObservation, type UsageRecord, type WindowsObservation } from './usage-record.js';
|
|
1
|
+
import { type PerMinuteObservation, type UsageRecord, type WindowHistorySample, type WindowsObservation } from './usage-record.js';
|
|
2
2
|
import type { QuotaSnapshot } from '../quota-cache.js';
|
|
3
3
|
import type { RateLimitSnapshot } from '../providers/shared/rate-limit-bucket.js';
|
|
4
4
|
import type { RateLimitGate } from '../providers/shared/tracing-fetch-utils.js';
|
|
5
5
|
import type { UsageResult } from '../subscription-usage.js';
|
|
6
|
+
export declare function bindingSampleFromWindows(w: WindowsObservation): WindowHistorySample | undefined;
|
|
6
7
|
export declare function resetUsageLedgerForTests(): void;
|
|
7
8
|
export declare function publishUsage(rec: UsageRecord, now?: number): void;
|
|
8
9
|
export declare function readLedgerRecords(): UsageRecord[];
|
|
@@ -12,12 +12,18 @@ export interface WindowObservation {
|
|
|
12
12
|
utilization: number;
|
|
13
13
|
resetsAt?: number;
|
|
14
14
|
}
|
|
15
|
+
export interface WindowHistorySample {
|
|
16
|
+
readonly observedAt: number;
|
|
17
|
+
readonly utilization: number;
|
|
18
|
+
readonly resetsAt?: number;
|
|
19
|
+
}
|
|
15
20
|
export interface WindowsObservation {
|
|
16
21
|
fiveHour?: WindowObservation;
|
|
17
22
|
sevenDay?: WindowObservation;
|
|
18
23
|
sevenDaySonnet?: WindowObservation;
|
|
19
24
|
sevenDayOpus?: WindowObservation;
|
|
20
25
|
observedAt: number;
|
|
26
|
+
history?: WindowHistorySample[];
|
|
21
27
|
}
|
|
22
28
|
export declare const WINDOW_KEYS: readonly ["fiveHour", "sevenDay", "sevenDaySonnet", "sevenDayOpus"];
|
|
23
29
|
export type WindowKey = (typeof WINDOW_KEYS)[number];
|
|
@@ -32,6 +38,8 @@ export interface UsageRecord {
|
|
|
32
38
|
windows?: WindowsObservation;
|
|
33
39
|
}
|
|
34
40
|
export declare function mergePerMinute(a: PerMinuteObservation | undefined, b: PerMinuteObservation | undefined): PerMinuteObservation | undefined;
|
|
41
|
+
export declare const WINDOWS_HISTORY_MAX = 12;
|
|
42
|
+
export declare function mergeWindowHistory(a: WindowHistorySample[] | undefined, b: WindowHistorySample[] | undefined): WindowHistorySample[] | undefined;
|
|
35
43
|
export declare function mergeWindows(a: WindowsObservation | undefined, b: WindowsObservation | undefined): WindowsObservation | undefined;
|
|
36
44
|
export declare function mergeUsageRecords(existing: UsageRecord | undefined, incoming: UsageRecord): UsageRecord;
|
|
37
45
|
export declare function parseUsageRecord(raw: unknown): UsageRecord | undefined;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { QuotaSnapshot } from '../agent/quota-cache.js';
|
|
2
|
+
import { type UsageRecord } from '../agent/usage/usage-record.js';
|
|
3
|
+
import { type WindowObservationSample } from '../agent/usage/burn-rate.js';
|
|
2
4
|
export interface QuotaWindowState {
|
|
3
5
|
readonly utilization: number;
|
|
4
6
|
readonly resetsAt?: Date;
|
|
7
|
+
readonly history?: readonly WindowObservationSample[];
|
|
5
8
|
}
|
|
6
9
|
export interface QuotaWindows {
|
|
7
10
|
readonly fiveHour?: QuotaWindowState;
|
|
@@ -9,6 +12,7 @@ export interface QuotaWindows {
|
|
|
9
12
|
readonly observedAt?: Date;
|
|
10
13
|
}
|
|
11
14
|
export declare function quotaWindowsFromSnapshot(snapshot: QuotaSnapshot | undefined): QuotaWindows | undefined;
|
|
15
|
+
export declare function quotaWindowsFromRecord(record: UsageRecord | undefined): QuotaWindows | undefined;
|
|
12
16
|
export type QuotaSeverity = 'calm' | 'caution' | 'critical';
|
|
13
17
|
export interface QuotaIndicator {
|
|
14
18
|
readonly text: string;
|