qlogicagent 2.24.7 → 2.24.9

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.
Files changed (42) hide show
  1. package/dist/agent.js +10 -70
  2. package/dist/cli.js +7 -7
  3. package/dist/index.js +212 -272
  4. package/dist/orchestration.js +14 -14
  5. package/dist/types/agent/tool-loop/loop-helpers.d.ts +2 -34
  6. package/dist/types/agent/tool-loop.d.ts +7 -58
  7. package/dist/types/agent/types.d.ts +5 -17
  8. package/dist/types/cli/core-tools/agent-tool-service.d.ts +1 -2
  9. package/dist/types/cli/handlers/turn-handler.d.ts +1 -1
  10. package/dist/types/cli/mcp-bootstrap.d.ts +1 -1
  11. package/dist/types/cli/stdio-acp-protocol-coordinator.d.ts +1 -1
  12. package/dist/types/contracts/index.d.ts +1 -1
  13. package/dist/types/contracts/tool-execution-evidence.d.ts +0 -12
  14. package/dist/types/contracts/tool-name.d.ts +0 -5
  15. package/dist/types/contracts/turn-event.d.ts +7 -81
  16. package/dist/types/orchestration/tool-loop/tool-choice-policy.d.ts +0 -1
  17. package/dist/types/protocol/wire/notification-payloads.d.ts +2 -0
  18. package/dist/types/runtime/config/tunable-defaults.d.ts +0 -23
  19. package/dist/types/runtime/infra/agent-project-projection.d.ts +0 -1
  20. package/dist/types/runtime/infra/subagent-turn-snapshot.d.ts +0 -1
  21. package/dist/types/runtime/ports/agent-runtime-ports.d.ts +0 -1
  22. package/dist/types/runtime/prompt/system-prompt-sections.d.ts +1 -14
  23. package/dist/types/skills/tools/agent-tool.d.ts +0 -5
  24. package/dist/types/skills/tools/write-tool.d.ts +3 -11
  25. package/package.json +3 -4
  26. package/dist/types/agent/tool-loop/agent-argument-normalizer.d.ts +0 -12
  27. package/dist/types/agent/tool-loop/artifact-final-contract.d.ts +0 -171
  28. package/dist/types/agent/tool-loop/budget-continuation-policy.d.ts +0 -26
  29. package/dist/types/agent/tool-loop/completion-action-policy.d.ts +0 -48
  30. package/dist/types/agent/tool-loop/completion-stop-policy.d.ts +0 -19
  31. package/dist/types/agent/tool-loop/direct-response-contract.d.ts +0 -12
  32. package/dist/types/agent/tool-loop/final-status-stream-suppressor.d.ts +0 -22
  33. package/dist/types/agent/tool-loop/tool-failure-policy.d.ts +0 -50
  34. package/dist/types/agent/tool-loop/tool-result-classification.d.ts +0 -10
  35. package/dist/types/agent/tool-loop.test-harness.d.ts +0 -20
  36. package/dist/types/cli/test-support/fs-cleanup.d.ts +0 -19
  37. package/dist/types/cli/test-support/tool-catalog-fixture.d.ts +0 -3
  38. package/dist/types/contracts/structured-planner.d.ts +0 -2
  39. package/dist/types/runtime/infra/token-budget.d.ts +0 -92
  40. package/dist/types/runtime/prompt/prompt-policy.d.ts +0 -12
  41. package/dist/types/test-support/global-home-setup.d.ts +0 -2
  42. package/dist/types/test-support/project-store-fixture.d.ts +0 -11
@@ -1,50 +0,0 @@
1
- import type { ChatMessage } from "../types.js";
2
- import type { OpenAiToolCall } from "../../orchestration/index.js";
3
- export interface VariantBlockedToolCall {
4
- call: OpenAiToolCall;
5
- failCount: number;
6
- error: string;
7
- }
8
- export interface TypedCommercialRetryContract {
9
- billed: boolean | null;
10
- retryable: boolean;
11
- safeToRetry: boolean;
12
- retryMode: string;
13
- automaticRetryAuthorized: boolean;
14
- stage?: string;
15
- }
16
- /**
17
- * Locate the execution owner's explicit commercial retry contract without coupling the Agent
18
- * loop to a provider, MCP server, Skill, tool name, or error-envelope nesting convention.
19
- * A commercial operation is never eligible for an automatic verbatim retry unless every field
20
- * is present and the owner explicitly authorized it.
21
- */
22
- export declare function findTypedCommercialRetryContract(value: unknown): TypedCommercialRetryContract | undefined;
23
- export declare function splitVariantToolCalls(calls: readonly OpenAiToolCall[], toolFailureCounts: ReadonlyMap<string, number>,
24
- /**
25
- * Exact call signatures (name::rawArguments) that were variant-blocked at least once and are
26
- * eligible for ONE deliberate re-assertion pass. Mutated in place: blocking a call registers
27
- * its signature; a verbatim re-issue consumes it and runs. The engine cannot tell "another
28
- * variation of the failed thing" from "a genuinely different task in the same family"
29
- * (e.g. `pip install A` failing twice must not condemn `pip install C` forever) — so the
30
- * MODEL's insistence after seeing the warning is the judgment call. A variation-cycling loop
31
- * never re-issues verbatim, so it stays blocked; verbatim spam is capped separately by the
32
- * identical-call-repeat guard.
33
- */
34
- reassertedSignatures: Set<string>): {
35
- allowed: OpenAiToolCall[];
36
- blocked: VariantBlockedToolCall[];
37
- };
38
- export declare function variantBlockNudge(): ChatMessage;
39
- export declare function recordToolFailureResult(input: {
40
- toolFailureCounts: Map<string, number>;
41
- toolName: string;
42
- toolArguments?: string;
43
- ok: boolean;
44
- /** True when the tool succeeded but returned an empty/no-match result. Kept for caller clarity. */
45
- softEmpty: boolean;
46
- }): void;
47
- export declare function newVariantFailureNudges(input: {
48
- toolFailureCounts: ReadonlyMap<string, number>;
49
- snapshot: ReadonlyMap<string, number>;
50
- }): ChatMessage[];
@@ -1,10 +0,0 @@
1
- export type ToolResultClassification = "success" | "empty" | "error";
2
- export declare function classifyToolResult(r: {
3
- ok?: boolean;
4
- toolName: string;
5
- message: unknown;
6
- }): ToolResultClassification;
7
- export declare function isEmptyToolResult(r: {
8
- toolName: string;
9
- message: unknown;
10
- }): boolean;
@@ -1,20 +0,0 @@
1
- import type { AgentLogger, LLMChunk, LLMRequest, LLMTransport, ToolDefinition, TurnEvent } from "./types.js";
2
- import { type ToolLoopParams } from "./tool-loop.js";
3
- import type { ToolLoopRuntimePorts } from "../runtime/ports/index.js";
4
- /** A scripted LLM round: chunks to stream, or an error to throw on stream(). */
5
- export type Round = LLMChunk[] | {
6
- throw: unknown;
7
- };
8
- /** Transport that replays a fixed script of rounds — one round consumed per stream() call. */
9
- export declare class ScriptedTransport implements LLMTransport {
10
- private readonly rounds;
11
- readonly requests: LLMRequest[];
12
- constructor(rounds: Round[]);
13
- stream(request: LLMRequest): AsyncGenerator<LLMChunk>;
14
- }
15
- export declare const log: AgentLogger;
16
- export declare function tool(name?: string): ToolDefinition;
17
- export declare function runtimePorts(overrides?: Partial<ToolLoopRuntimePorts>): ToolLoopRuntimePorts;
18
- export declare function collect(events: AsyncIterable<TurnEvent>): Promise<TurnEvent[]>;
19
- export declare const eventTypes: (events: TurnEvent[]) => string[];
20
- export declare function baseParams(overrides: Partial<ToolLoopParams> & Pick<ToolLoopParams, "runtimePorts">): ToolLoopParams;
@@ -1,19 +0,0 @@
1
- export interface RmWithRetryOptions {
2
- /** Retries after the first attempt before giving up. Default 5. */
3
- retries?: number;
4
- /** Base backoff in ms; doubles each retry (100, 200, 400, …). Default 100. */
5
- baseDelayMs?: number;
6
- /** Removal primitive — injectable so the retry/backoff logic is unit-testable. */
7
- remove?: (target: string) => void;
8
- }
9
- /**
10
- * Recursively remove a path, retrying with exponential backoff when Windows
11
- * reports a transient file lock.
12
- *
13
- * Cleanup is best-effort: a leaked directory under the OS temp dir is harmless
14
- * and the OS reaps it, so exhausting the retries warns (loud and visible) instead
15
- * of throwing — a teardown race must never fail a test that already verified the
16
- * behaviour under test. A *non-transient* error (e.g. a bad path) is a real bug
17
- * and is rethrown immediately.
18
- */
19
- export declare function rmWithRetry(target: string, options?: RmWithRetryOptions): Promise<void>;
@@ -1,3 +0,0 @@
1
- import type { RuntimeToolContract, ToolCatalog } from "../../runtime/ports/index.js";
2
- export declare function createToolCatalogFixture(initialTools?: RuntimeToolContract[]): ToolCatalog;
3
- export declare function createToolFixture(name: string, overrides?: Partial<RuntimeToolContract>): RuntimeToolContract;
@@ -1,2 +0,0 @@
1
- export declare const STRUCTURED_PLANNER_SYSTEM_PROMPT_MARKER = "<qlogicagent-mode>structured-planner</qlogicagent-mode>";
2
- export declare function isStructuredPlannerSystemPrompt(value: unknown): boolean;
@@ -1,92 +0,0 @@
1
- /**
2
- * Sub-agent Token Budget EnforcerCC-aligned budget limits.
3
- *
4
- * Prevents sub-agents from consuming infinite tokens by:
5
- * 1. Per-task token budget (from TaskStateBase.tokenBudget)
6
- * 2. Session-level aggregate budget (all tasks combined)
7
- * 3. Budget continuation messages (CC tokenBudget.ts pattern)
8
- * 4. Graceful degradation (warn -> force-stop, never hard-crash)
9
- *
10
- * CC reference: utils/tokenBudget.ts, main.tsxmax-budget-usd /task-budget
11
- *
12
- * Key difference from CC: We track prompt + completion tokens (not USD).
13
- * CC has no explicit per-sub-agent budget; they rely on session-level maxBudgetUsd.
14
- * We add per-task enforcement to prevent a single sub-agent from exhausting the budget.
15
- */
16
- import type { WireTokenUsage as TokenUsage } from "../../protocol/wire/index.js";
17
- export interface BudgetConfig {
18
- /** Per-task token budget (prompt + completion). 0 = unlimited. */
19
- taskBudgetTokens: number;
20
- /** Session-level token budget across all tasks. 0 = unlimited. */
21
- sessionBudgetTokens: number;
22
- /** Warning threshold as percentage (0-100). Default: 80. */
23
- warningThresholdPct: number;
24
- }
25
- export interface TaskBudgetState {
26
- taskId: string;
27
- /** Token budget for this task. 0 = unlimited. */
28
- budgetTokens: number;
29
- /** Accumulated token usage for this task. */
30
- usage: TokenUsage;
31
- /** Whether a warning has been issued for this task. */
32
- warned: boolean;
33
- /** Whether this task has been force-stopped due to budget. */
34
- stopped: boolean;
35
- }
36
- export interface SessionBudgetState {
37
- /** Session-level budget. 0 = unlimited. */
38
- budgetTokens: number;
39
- /** Aggregate usage across ALL tasks in this session. */
40
- totalUsage: TokenUsage;
41
- /** Per-task states keyed by taskId. */
42
- tasks: Map<string, TaskBudgetState>;
43
- }
44
- export type BudgetCheckResult = {
45
- status: "ok";
46
- } | {
47
- status: "warning";
48
- message: string;
49
- usagePct: number;
50
- } | {
51
- status: "exceeded";
52
- message: string;
53
- usagePct: number;
54
- };
55
- /**
56
- * Parse a token budget from user text input.
57
- * CC reference: parseTokenBudget()
58
- *
59
- * Supports:
60
- * - Shorthand start: "+500k", "+1.5m"
61
- * - Shorthand end: "keep working +1m."
62
- * - Verbose: "use 500k tokens", "spend 1.5M tokens"
63
- */
64
- export declare function parseTokenBudget(text: string): number | null;
65
- /**
66
- * Generate a budget continuation message (CC getBudgetContinuationMessage pattern).
67
- * Appended to the assistant context when approaching budget limits.
68
- */
69
- export declare function getBudgetContinuationMessage(usagePct: number, currentTokens: number, budgetTokens: number): string;
70
- export declare function createSessionBudgetState(config?: Partial<BudgetConfig>): SessionBudgetState;
71
- export declare function registerTaskBudget(session: SessionBudgetState, taskId: string, budgetTokens: number): TaskBudgetState;
72
- /**
73
- * Record token usage for a task and aggregate into session.
74
- */
75
- export declare function recordTaskUsage(session: SessionBudgetState, taskId: string, usage: TokenUsage): void;
76
- /**
77
- * Check whether a task is within its token budget.
78
- */
79
- export declare function checkTaskBudget(session: SessionBudgetState, taskId: string, config?: Partial<BudgetConfig>): BudgetCheckResult;
80
- /**
81
- * Get a summary of all task budgets in a session.
82
- */
83
- export declare function getSessionBudgetSummary(session: SessionBudgetState): {
84
- sessionUsed: number;
85
- sessionBudget: number;
86
- tasks: Array<{
87
- taskId: string;
88
- used: number;
89
- budget: number;
90
- stopped: boolean;
91
- }>;
92
- };
@@ -1,12 +0,0 @@
1
- export declare const PROMPT_POLICY_VERSION = 2;
2
- export interface PromptPolicyRegistryEntry {
3
- id: string;
4
- version: number;
5
- summary: string;
6
- }
7
- export interface PromptPolicyRegistry {
8
- version: number;
9
- entries: readonly PromptPolicyRegistryEntry[];
10
- }
11
- export declare const PROMPT_POLICY_REGISTRY: PromptPolicyRegistry;
12
- export declare function createPromptPolicyHeader(registry?: PromptPolicyRegistry): string;
@@ -1,2 +0,0 @@
1
- export declare function setupGlobalTestHome(): () => void;
2
- export default function globalSetup(): () => void;
@@ -1,11 +0,0 @@
1
- import type { AgentProjectInfo, AgentProjectType } from "../runtime/infra/agent-project-projection.js";
2
- export * from "../runtime/infra/project-store.js";
3
- export declare function resetProjectStore(): void;
4
- export declare function createProject(params: {
5
- name: string;
6
- workspaceDir: string;
7
- type?: AgentProjectType;
8
- groupId?: string;
9
- skipAutoSwitch?: boolean;
10
- }): AgentProjectInfo;
11
- export declare function switchProject(projectId: string): AgentProjectInfo | null;