@wrongstack/core 0.306.4 → 0.307.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/chronicle/index.js +957 -953
- package/dist/chronicle/metrics-ingest.d.ts +55 -0
- package/dist/chronicle/metrics-schema.d.ts +86 -0
- package/dist/chronicle/metrics-store.d.ts +5 -120
- package/dist/chronicle/project-server.js +1083 -1084
- package/dist/chronicle/sqlite-journal-quota.d.ts +39 -0
- package/dist/chronicle/sqlite-journal-schema.d.ts +25 -0
- package/dist/chronicle/sqlite-journal.d.ts +12 -177
- package/dist/coordination/agents/index.js +1738 -1690
- package/dist/coordination/agents/project-agent-capture.d.ts +48 -0
- package/dist/coordination/agents/project-agent-identity.d.ts +3 -129
- package/dist/coordination/agents/project-agent-roster.d.ts +17 -0
- package/dist/coordination/index.js +6011 -5894
- package/dist/coordination/mail-tools.d.ts +1 -1
- package/dist/coordination/mailbox-http-actor-query.d.ts +16 -0
- package/dist/coordination/mailbox-http-router.d.ts +0 -48
- package/dist/coordination/mailbox-http-sse.d.ts +12 -0
- package/dist/coordination/mailbox-message-types.d.ts +71 -0
- package/dist/coordination/mailbox-predicates.d.ts +13 -0
- package/dist/coordination/mailbox-project-server.js +1 -1
- package/dist/coordination/mailbox-session-sync.d.ts +8 -0
- package/dist/coordination/mailbox-types.d.ts +6 -793
- package/dist/core/agent-loop-context.d.ts +28 -0
- package/dist/core/agent-loop-detector.d.ts +25 -0
- package/dist/core/fallback-doctor.d.ts +72 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1159 -888
- package/dist/defaults/index.js +3579 -3545
- package/dist/execution/autonomy-brain-llm.d.ts +55 -0
- package/dist/execution/autonomy-brain.d.ts +3 -156
- package/dist/execution/compaction-budget.d.ts +38 -0
- package/dist/execution/compaction-core.d.ts +3 -170
- package/dist/execution/compaction-elision.d.ts +58 -0
- package/dist/execution/council-orchestrator-helpers.d.ts +39 -0
- package/dist/execution/council-orchestrator.d.ts +3 -42
- package/dist/execution/council-response-parser.d.ts +56 -0
- package/dist/execution/index.js +2415 -2443
- package/dist/execution/prompt-enhancer.js +11 -3
- package/dist/execution/tool-executor-guard.d.ts +18 -0
- package/dist/execution/tool-executor-runner.d.ts +12 -0
- package/dist/execution/tool-executor.d.ts +0 -75
- package/dist/goal/index.js +19 -6
- package/dist/hq/index.js +8 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7813 -7292
- package/dist/infrastructure/index.js +3 -1
- package/dist/kernel/events/agent-events.d.ts +2 -0
- package/dist/kernel/events/provider-events.d.ts +13 -0
- package/dist/plugin/index.js +2590 -2561
- package/dist/plugins/auto-review-config.d.ts +53 -0
- package/dist/plugins/auto-review-git.d.ts +19 -0
- package/dist/plugins/auto-review-plugin.d.ts +2 -140
- package/dist/plugins/review-finding-verification.d.ts +7 -0
- package/dist/prompts/index.d.ts +1 -0
- package/dist/prompts/prompt-journal.d.ts +94 -0
- package/dist/security/index.js +627 -652
- package/dist/security/permission-explain.d.ts +19 -0
- package/dist/security/permission-policy.d.ts +0 -101
- package/dist/security/yolo-risk.d.ts +5 -4
- package/dist/session-catalog/index.js +220 -212
- package/dist/session-catalog/project-server.js +227 -219
- package/dist/session-catalog/store-rebuild.d.ts +9 -0
- package/dist/session-catalog/store-schema.d.ts +48 -0
- package/dist/session-catalog/store.d.ts +0 -17
- package/dist/storage/director-state.d.ts +6 -0
- package/dist/storage/file-session-writer.d.ts +2 -58
- package/dist/storage/index.d.ts +2 -1
- package/dist/storage/index.js +2057 -1925
- package/dist/storage/orphan-lock-cleaner.d.ts +15 -0
- package/dist/storage/session-recovery.d.ts +9 -0
- package/dist/storage/session-store/rename-session.d.ts +16 -0
- package/dist/storage/session-store/resume-session.d.ts +26 -0
- package/dist/storage/session-store/session-store-clear.d.ts +11 -0
- package/dist/storage/session-store/session-store-index.d.ts +13 -0
- package/dist/storage/session-store.d.ts +1 -129
- package/dist/storage/session-summary-tracker.d.ts +39 -0
- package/dist/storage/session-write-buffer.d.ts +43 -0
- package/dist/storage/session-writer/session-writer-flush.d.ts +4 -0
- package/dist/storage/session-writer/session-writer-summary-tracker.d.ts +28 -0
- package/dist/tools/fallback-agent-model-assign-tool.d.ts +18 -0
- package/dist/tools/fallback-leader-model-set-tool.d.ts +18 -0
- package/dist/tools/fallback-manage-tools.d.ts +8 -45
- package/dist/tools/fallback-profile-manage-tool.d.ts +16 -0
- package/dist/tools/fallback-provider-key-set-tool.d.ts +17 -0
- package/dist/tools/fallback-provider-manage-tool.d.ts +26 -0
- package/dist/tools/index.js +5070 -5071
- package/dist/types/config/root.d.ts +7 -2
- package/dist/types/default-config.d.ts +1 -1
- package/dist/types/index.d.ts +54 -55
- package/dist/types/index.js +953 -932
- package/dist/types/runtime-capability-manifest.d.ts +5 -5
- package/dist/types/session-markers.d.ts +12 -0
- package/dist/types/session-markers.js +19 -0
- package/dist/worktree/worktree-manager.d.ts +1 -1
- package/instructions/coordination/subagent-baseline.md +2 -2
- package/instructions/llm/prompt-enhancer.md +2 -1
- package/instructions/sections/tool/common-patterns.md +21 -0
- package/instructions/sections/tool/delegation-compact.md +3 -1
- package/instructions/sections/tool/delegation-full.md +5 -1
- package/instructions/system-lite.md +28 -3
- package/instructions/system-pro.md +37 -8
- package/instructions/system.md +4 -2
- package/package.json +5 -5
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Request } from '../types/provider.js';
|
|
2
|
+
import { type RequestTokenBreakdown } from '../utils/token-estimate.js';
|
|
3
|
+
import type { AgentInternals } from './agent-internals.js';
|
|
4
|
+
import type { AgentResponseHandler } from './agent-response.js';
|
|
5
|
+
import { type RunOptions } from './context.js';
|
|
6
|
+
export interface AgentLoopContextManager {
|
|
7
|
+
refreshProviderContextLimit(provider: import('../types/provider.js').Provider, model: string, opts?: {
|
|
8
|
+
probe?: boolean;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
compactContextIfNeeded(): Promise<boolean>;
|
|
11
|
+
stashRequestTokens(req: Request): RequestTokenBreakdown;
|
|
12
|
+
refreshContextRequestTokenStash(opts?: {
|
|
13
|
+
force?: boolean | undefined;
|
|
14
|
+
}): number;
|
|
15
|
+
buildRequestWithPreflightCompaction(opts: RunOptions): Promise<{
|
|
16
|
+
req: Request;
|
|
17
|
+
provider: import('../types/provider.js').Provider;
|
|
18
|
+
preFlight: RequestTokenBreakdown;
|
|
19
|
+
}>;
|
|
20
|
+
emitContextPct(): void;
|
|
21
|
+
currentMaxContext(): number;
|
|
22
|
+
calibrationKey(model?: string): string;
|
|
23
|
+
get lastPreFlightMsgCount(): number;
|
|
24
|
+
}
|
|
25
|
+
export declare function createAgentLoopContextManager(a: AgentInternals, handlers: {
|
|
26
|
+
response: AgentResponseHandler;
|
|
27
|
+
}): AgentLoopContextManager;
|
|
28
|
+
//# sourceMappingURL=agent-loop-context.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ContentBlock, ToolUseBlock } from '../types/blocks.js';
|
|
2
|
+
import type { AgentInternals } from './agent-internals.js';
|
|
3
|
+
export declare function iterationFingerprint(blocks: ContentBlock[]): string;
|
|
4
|
+
export declare function stableStringify(value: unknown): string;
|
|
5
|
+
export declare function canonicalize(value: unknown): unknown;
|
|
6
|
+
export declare function hashSmall(s: string): string;
|
|
7
|
+
export interface LoopDetectorResult {
|
|
8
|
+
action: 'none' | 'steer' | 'cut';
|
|
9
|
+
cutSummary?: string;
|
|
10
|
+
steerMessage?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class AgentLoopDetector {
|
|
13
|
+
private readonly a;
|
|
14
|
+
private lastToolSignature;
|
|
15
|
+
private toolLoopCount;
|
|
16
|
+
private iterationSteerDone;
|
|
17
|
+
private readonly recentCallKeys;
|
|
18
|
+
private readonly steeredCallKeys;
|
|
19
|
+
constructor(a: AgentInternals);
|
|
20
|
+
checkIteration(iterationIndex: number, content: ContentBlock[], toolUses: ToolUseBlock[], queueSteer: (text: string) => void): {
|
|
21
|
+
cut: boolean;
|
|
22
|
+
cutSummary?: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=agent-loop-detector.d.ts.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FallbackDoctor — diagnostic and simulation engine for WrongStack fallback systems.
|
|
3
|
+
*
|
|
4
|
+
* Provides deep inspection of active fallback configurations, diagnosing:
|
|
5
|
+
* - Single-provider sibling quarantine risks (account-wide token/quota blocks)
|
|
6
|
+
* - Context window bottlenecks (models too small for long sessions)
|
|
7
|
+
* - Provider credential and configuration health
|
|
8
|
+
* - Real-time quarantine / waiting room blocks
|
|
9
|
+
* - Step-by-step failover simulation for hypothetical errors (429, quota, etc.)
|
|
10
|
+
*/
|
|
11
|
+
import type { ProviderModelStatusTracker } from '../coordination/provider-status-tracker.js';
|
|
12
|
+
import type { Config } from '../types/config.js';
|
|
13
|
+
import { type ProviderErrorKind } from '../types/provider.js';
|
|
14
|
+
export interface FallbackDiagnosticWarning {
|
|
15
|
+
readonly code: 'EMPTY_CHAIN' | 'SIBLING_QUARANTINE_RISK' | 'PROVIDER_UNUSABLE' | 'MODEL_QUARANTINED' | 'CALENDAR_BLOCKED' | 'CONTEXT_WINDOW_WARNING';
|
|
16
|
+
readonly severity: 'warning' | 'critical' | 'info';
|
|
17
|
+
readonly message: string;
|
|
18
|
+
readonly target?: string | undefined;
|
|
19
|
+
readonly recommendation?: string | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface FallbackDiagnosticReport {
|
|
22
|
+
readonly primary: {
|
|
23
|
+
readonly providerId: string;
|
|
24
|
+
readonly model: string;
|
|
25
|
+
};
|
|
26
|
+
readonly activeProfile: string | undefined;
|
|
27
|
+
readonly explicitChain: readonly string[];
|
|
28
|
+
readonly effectiveOrder: readonly string[];
|
|
29
|
+
readonly autoEnabled: boolean;
|
|
30
|
+
readonly status: 'healthy' | 'warning' | 'critical';
|
|
31
|
+
readonly warnings: readonly FallbackDiagnosticWarning[];
|
|
32
|
+
readonly crossProviderCount: number;
|
|
33
|
+
readonly uniqueProviders: readonly string[];
|
|
34
|
+
}
|
|
35
|
+
export interface FallbackSimulationStep {
|
|
36
|
+
readonly index: number;
|
|
37
|
+
readonly providerId: string;
|
|
38
|
+
readonly model: string;
|
|
39
|
+
readonly skipped: boolean;
|
|
40
|
+
readonly reason?: string | undefined;
|
|
41
|
+
readonly providerSwitched: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface FallbackSimulationResult {
|
|
44
|
+
readonly triggeringError: ProviderErrorKind;
|
|
45
|
+
readonly isFallbackEligible: boolean;
|
|
46
|
+
readonly primary: {
|
|
47
|
+
readonly providerId: string;
|
|
48
|
+
readonly model: string;
|
|
49
|
+
};
|
|
50
|
+
readonly steps: readonly FallbackSimulationStep[];
|
|
51
|
+
readonly finalTarget: {
|
|
52
|
+
readonly providerId: string;
|
|
53
|
+
readonly model: string;
|
|
54
|
+
} | null;
|
|
55
|
+
readonly summary: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Diagnose the active fallback configuration and chain for common failure modes.
|
|
59
|
+
*/
|
|
60
|
+
export declare function diagnoseFallbackConfig(config: Config, tracker?: ProviderModelStatusTracker | undefined, opts?: {
|
|
61
|
+
modelContextLimitMap?: Record<string, number> | undefined;
|
|
62
|
+
} | undefined): FallbackDiagnosticReport;
|
|
63
|
+
/**
|
|
64
|
+
* Simulate a failover scenario for a given error kind and token level.
|
|
65
|
+
*/
|
|
66
|
+
export declare function simulateFallbackFailover(config: Config, opts?: {
|
|
67
|
+
errorKind?: ProviderErrorKind | undefined;
|
|
68
|
+
currentTokens?: number | undefined;
|
|
69
|
+
statusTracker?: ProviderModelStatusTracker | undefined;
|
|
70
|
+
modelContextLimitMap?: Record<string, number> | undefined;
|
|
71
|
+
}): FallbackSimulationResult;
|
|
72
|
+
//# sourceMappingURL=fallback-doctor.d.ts.map
|
package/dist/core/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { buildBtwBlock, consumeBtwNotes, pendingBtwCount, setBtwNote, } from './
|
|
|
4
4
|
export { Context, type ContextInit, type ProviderMemoryEvidence, type RunOptions, type TodoItem, } from './context.js';
|
|
5
5
|
export { type ContinuationInput, type ContinuationSource, detectContinueIntent, type ResolvedContinuation, resolveContinuation, } from './continue-intent.js';
|
|
6
6
|
export { ConversationState, type ReadonlyConversationState, type StateChange, type StateChangeHandler, wrapAsState, } from './conversation-state.js';
|
|
7
|
+
export { diagnoseFallbackConfig, type FallbackDiagnosticReport, type FallbackDiagnosticWarning, type FallbackSimulationResult, type FallbackSimulationStep, simulateFallbackFailover, } from './fallback-doctor.js';
|
|
7
8
|
export { createFallbackModelExtension, effectiveFallbackChain, type FallbackGateFn, type FallbackModelDeps, fallbackProfileChain, runtimeFallbackChain, smartDefaultFallbackChain, } from './fallback-model.js';
|
|
8
9
|
export { FallbackProfileManager } from './fallback-profile-manager.js';
|
|
9
10
|
export { InputBuilder, type InputBuilderEvent, type InputBuilderOptions, } from './input-builder.js';
|