qlogicagent 2.16.5 → 2.16.7
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.js +20 -20
- package/dist/cli.js +375 -370
- package/dist/index.js +374 -369
- package/dist/orchestration.js +10 -10
- package/dist/protocol.js +1 -1
- package/dist/types/agent/tool-loop/loop-helpers.d.ts +1 -4
- package/dist/types/agent/tool-loop/pseudo-tool-output.d.ts +8 -0
- package/dist/types/agent/tool-loop/tool-failure-policy.d.ts +0 -1
- package/dist/types/agent/tool-loop/tool-guardrails.d.ts +24 -0
- package/dist/types/agent/tool-loop/tool-result-classification.d.ts +10 -0
- package/dist/types/cli/acp-commands.d.ts +1 -2
- package/dist/types/cli/base-tool-bootstrap.d.ts +1 -0
- package/dist/types/cli/handlers/files-handler.d.ts +5 -0
- package/dist/types/cli/handlers/message-feedback-handler.d.ts +29 -0
- package/dist/types/cli/handlers/pinned-skill-context.d.ts +2 -0
- package/dist/types/cli/handlers/project-handler.d.ts +1 -0
- package/dist/types/cli/handlers/turn-baseline-handler.d.ts +8 -0
- package/dist/types/cli/handlers/turn-handler.d.ts +5 -0
- package/dist/types/cli/handlers/working-materials-handler.d.ts +9 -0
- package/dist/types/cli/idle-dream-coordinator.d.ts +6 -0
- package/dist/types/cli/mcp-bootstrap.d.ts +1 -0
- package/dist/types/cli/rpc-registry.d.ts +6 -0
- package/dist/types/cli/skill-invocation-service.d.ts +2 -0
- package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +1 -0
- package/dist/types/cli/stdio-runtime-bootstrap.d.ts +1 -0
- package/dist/types/cli/tool-bootstrap-core-registration.d.ts +1 -0
- package/dist/types/cli/tool-bootstrap.d.ts +1 -0
- package/dist/types/protocol/methods.d.ts +24 -0
- package/dist/types/protocol/wire/agent-events.d.ts +2 -2
- package/dist/types/protocol/wire/gateway-rpc.d.ts +160 -0
- package/dist/types/protocol/wire/notification-payloads.d.ts +27 -0
- package/dist/types/runtime/execution/untrusted-tool-result.d.ts +2 -0
- package/dist/types/runtime/infra/feedback-distillation-worker.d.ts +20 -0
- package/dist/types/runtime/infra/feedback-distillation.d.ts +30 -0
- package/dist/types/runtime/infra/feedback-event-store.d.ts +160 -0
- package/dist/types/runtime/infra/feedback-outbox.d.ts +26 -0
- package/dist/types/runtime/infra/feedback-redaction.d.ts +71 -0
- package/dist/types/runtime/infra/feedback-upload-client.d.ts +39 -0
- package/dist/types/runtime/infra/feedback-upload-worker.d.ts +11 -0
- package/dist/types/runtime/infra/skill-resolver.d.ts +8 -2
- package/dist/types/runtime/infra/turn-baseline-store.d.ts +102 -0
- package/dist/types/runtime/infra/turn-telemetry-store.d.ts +59 -0
- package/dist/types/runtime/infra/working-materials-store.d.ts +35 -0
- package/dist/types/runtime/ports/memory-provider.d.ts +6 -0
- package/dist/types/runtime/ports/tool-contracts.d.ts +1 -0
- package/dist/types/runtime/prompt/fresh-workspace-evidence.d.ts +14 -0
- package/dist/types/skills/mcp/mcp-manager.d.ts +31 -2
- package/dist/types/skills/memory/local-memory-provider.d.ts +3 -3
- package/dist/types/skills/memory/local-store-records.d.ts +18 -1
- package/dist/types/skills/memory/local-store.d.ts +8 -195
- package/dist/types/skills/memory/memory-consolidation.d.ts +14 -0
- package/dist/types/skills/memory/sqlite-memory-schema.d.ts +1 -1
- package/dist/types/skills/skill-system/skill-bundles.d.ts +8 -0
- package/dist/types/skills/skill-system/skill-frontmatter.d.ts +1 -5
- package/dist/types/skills/skill-system/skill-lifecycle.d.ts +13 -1
- package/dist/types/skills/skill-system/skill-preprocessing.d.ts +11 -0
- package/dist/types/skills/skill-system/skill-types.d.ts +0 -75
- package/dist/types/skills/skill-system/skill-validation.d.ts +1 -0
- package/dist/types/skills/tools/skill-tool.d.ts +3 -2
- package/dist/vendor/hatch-pet/LICENSE.txt +201 -201
- package/dist/vendor/hatch-pet/NOTICE.md +25 -25
- package/dist/vendor/hatch-pet/references/animation-rows.md +29 -29
- package/dist/vendor/hatch-pet/references/codex-pet-contract.md +35 -35
- package/dist/vendor/hatch-pet/references/qa-rubric.md +66 -66
- package/dist/vendor/hatch-pet/scripts/compose_atlas.py +169 -169
- package/dist/vendor/hatch-pet/scripts/derive_running_left_from_running_right.py +150 -150
- package/dist/vendor/hatch-pet/scripts/extract_strip_frames.py +408 -408
- package/dist/vendor/hatch-pet/scripts/inspect_frames.py +256 -256
- package/dist/vendor/hatch-pet/scripts/make_contact_sheet.py +96 -96
- package/dist/vendor/hatch-pet/scripts/prepare_pet_run.py +834 -834
- package/dist/vendor/hatch-pet/scripts/render_animation_previews.py +78 -78
- package/dist/vendor/hatch-pet/scripts/validate_atlas.py +157 -157
- package/package.json +3 -2
- package/dist/types/skills/skill-system/skill-source.d.ts +0 -38
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { FeedbackEvent, FeedbackRating, FeedbackReason, FeedbackState, FeedbackToolSummary, FeedbackUsage, TelemetryStatus } from "./feedback-event-store.js";
|
|
2
|
+
/** Bump when the redaction rules change so uploaded samples stay traceable (§8.6/§13). */
|
|
3
|
+
export declare const REDACTION_VERSION = "feedback-redaction-v1";
|
|
4
|
+
export interface RedactedFeedbackEvent {
|
|
5
|
+
feedbackId: string;
|
|
6
|
+
rating: FeedbackRating;
|
|
7
|
+
reason?: FeedbackReason;
|
|
8
|
+
state: FeedbackState;
|
|
9
|
+
/** Hashed identity — correlate without exposing local ids (§8.6). */
|
|
10
|
+
messageHash: string;
|
|
11
|
+
sessionIdHash: string;
|
|
12
|
+
projectIdHash?: string;
|
|
13
|
+
turnIdHash: string;
|
|
14
|
+
/** ≤500 chars, secrets/emails/absolute-paths scrubbed (§13). */
|
|
15
|
+
messagePreview: string;
|
|
16
|
+
model?: string;
|
|
17
|
+
provider?: string;
|
|
18
|
+
agentMode?: FeedbackEvent["agentMode"];
|
|
19
|
+
sourceChannel?: string;
|
|
20
|
+
usage?: FeedbackUsage;
|
|
21
|
+
/** Tool names only (never args). */
|
|
22
|
+
toolSummary?: FeedbackToolSummary;
|
|
23
|
+
fileContext?: {
|
|
24
|
+
changedFileCount?: number;
|
|
25
|
+
hasTurnFileChanges?: boolean;
|
|
26
|
+
diffOpenState?: "not_applicable" | "opened" | "failed" | "unknown";
|
|
27
|
+
};
|
|
28
|
+
browserContext?: {
|
|
29
|
+
hadToastError?: boolean;
|
|
30
|
+
visiblePanel?: "chat" | "artifact" | "diff" | "unknown";
|
|
31
|
+
};
|
|
32
|
+
telemetryStatus: TelemetryStatus;
|
|
33
|
+
redactionVersion: string;
|
|
34
|
+
createdAt: string;
|
|
35
|
+
}
|
|
36
|
+
export interface FeedbackRollup {
|
|
37
|
+
rollupId: string;
|
|
38
|
+
periodStart: string;
|
|
39
|
+
periodEnd: string;
|
|
40
|
+
total: number;
|
|
41
|
+
upCount: number;
|
|
42
|
+
downCount: number;
|
|
43
|
+
/** Down-vote reason → count. */
|
|
44
|
+
byReason: Record<string, number>;
|
|
45
|
+
byModel: Record<string, {
|
|
46
|
+
up: number;
|
|
47
|
+
down: number;
|
|
48
|
+
}>;
|
|
49
|
+
byAgentMode: Record<string, {
|
|
50
|
+
up: number;
|
|
51
|
+
down: number;
|
|
52
|
+
}>;
|
|
53
|
+
telemetryStatusCounts: {
|
|
54
|
+
complete: number;
|
|
55
|
+
partial: number;
|
|
56
|
+
missing: number;
|
|
57
|
+
};
|
|
58
|
+
redactionVersion: string;
|
|
59
|
+
createdAt: string;
|
|
60
|
+
}
|
|
61
|
+
/** Truncate to the preview limit and scrub api keys / emails / absolute paths (§13). */
|
|
62
|
+
export declare function sanitizePreview(text: string): string;
|
|
63
|
+
/** Map a local feedback event to its upload-safe redacted form (§8.6/§13). */
|
|
64
|
+
export declare function redactFeedbackEvent(event: FeedbackEvent, redactionVersion?: string): RedactedFeedbackEvent;
|
|
65
|
+
/** Pre-aggregate a batch of local events into a rollup for low-cost trend upload (§10). */
|
|
66
|
+
export declare function aggregateFeedbackRollup(events: FeedbackEvent[], input: {
|
|
67
|
+
rollupId: string;
|
|
68
|
+
periodStart: string;
|
|
69
|
+
periodEnd: string;
|
|
70
|
+
redactionVersion?: string;
|
|
71
|
+
}): FeedbackRollup;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feedback upload client — the single HTTP exit that ships redacted feedback to the llmrouter
|
|
3
|
+
* feedback backend (design §8.6, §9.1 rule 4). The redaction worker calls this directly; the
|
|
4
|
+
* messageFeedback.uploadBatch RPC wraps it for manual/test triggers.
|
|
5
|
+
*
|
|
6
|
+
* Transport mirrors the usage client: append the route to the llmrouter base already injected into
|
|
7
|
+
* the agent (QLOGIC_LLMROUTER_BASE_URL, e.g. https://www.qlogicagent.com/api) and authenticate with
|
|
8
|
+
* the injected Bearer QLOGIC_LLMROUTER_ACCESS_TOKEN. Feedback lands at <base>/client/feedback, so a
|
|
9
|
+
* batch POSTs to <base>/client/feedback/uploadBatch — the contract the llmrouter ingest endpoint
|
|
10
|
+
* (Phase 3b) implements. No dedicated feedback env: one llmrouter base, like /client/usage.
|
|
11
|
+
*/
|
|
12
|
+
import type { FeedbackRollup, RedactedFeedbackEvent } from "./feedback-redaction.js";
|
|
13
|
+
export interface UploadBatchInput {
|
|
14
|
+
batchId: string;
|
|
15
|
+
events: RedactedFeedbackEvent[];
|
|
16
|
+
rollups: FeedbackRollup[];
|
|
17
|
+
redactionVersion: string;
|
|
18
|
+
clientBuild?: string;
|
|
19
|
+
runtimeVersion?: string;
|
|
20
|
+
qlogicagentVersion?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface UploadBatchResult {
|
|
23
|
+
ok: boolean;
|
|
24
|
+
accepted?: number;
|
|
25
|
+
status?: number;
|
|
26
|
+
error?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Resolve the feedback ingest base, derived from the llmrouter base already injected into the agent
|
|
30
|
+
* (QLOGIC_LLMROUTER_BASE_URL), mirroring how the usage client reaches /client/usage. Returns
|
|
31
|
+
* undefined when llmrouter is not configured.
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveFeedbackUploadBaseUrl(): string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Ship one redacted batch to llmrouter. Fail-soft: an unconfigured base or a transport/HTTP error
|
|
36
|
+
* returns { ok: false }, so the caller (worker) keeps the events eligible and queues a retry rather
|
|
37
|
+
* than dropping feedback. Idempotent at the server by batchId + event id (§9.1 rule 5).
|
|
38
|
+
*/
|
|
39
|
+
export declare function uploadFeedbackBatch(input: UploadBatchInput, signal?: AbortSignal): Promise<UploadBatchResult>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface FeedbackSweepResult {
|
|
2
|
+
uploaded: number;
|
|
3
|
+
queued: number;
|
|
4
|
+
retried: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* One feedback upload sweep for a project. Retries due outbox batches, then redacts + ships any
|
|
8
|
+
* newly uploadable events. Fail-soft: a failed upload is queued in the outbox (its events assigned
|
|
9
|
+
* the batchId so they are not re-picked) and retried on a later sweep with backoff.
|
|
10
|
+
*/
|
|
11
|
+
export declare function runFeedbackUploadSweep(projectId: string, now?: Date): Promise<FeedbackSweepResult>;
|
|
@@ -26,8 +26,14 @@ export interface ResolvedSkill {
|
|
|
26
26
|
systemGenerated: boolean;
|
|
27
27
|
description?: string;
|
|
28
28
|
version?: string;
|
|
29
|
+
requiredTools?: string[];
|
|
30
|
+
environments?: string[];
|
|
29
31
|
}
|
|
30
32
|
export declare function isSystemGeneratedSkillName(name: string): boolean;
|
|
33
|
+
export interface SkillActivationContext {
|
|
34
|
+
availableToolNames?: Iterable<string>;
|
|
35
|
+
currentEnvironment?: string;
|
|
36
|
+
}
|
|
31
37
|
/**
|
|
32
38
|
* Resolve all skills in the global store, annotated with global/project mute state and whether
|
|
33
39
|
* they're active in the given project context.
|
|
@@ -35,9 +41,9 @@ export declare function isSystemGeneratedSkillName(name: string): boolean;
|
|
|
35
41
|
* Returns ALL store skills (active and inactive) so listing surfaces can show enable/disable state;
|
|
36
42
|
* callers that only want active skills filter `.active` (or use resolveActiveSkills).
|
|
37
43
|
*/
|
|
38
|
-
export declare function resolveSkills(projectRoot?: string): ResolvedSkill[];
|
|
44
|
+
export declare function resolveSkills(projectRoot?: string, activation?: SkillActivationContext): ResolvedSkill[];
|
|
39
45
|
/** Only the skills active in the given project (for the system-prompt skills catalog / resolution). */
|
|
40
|
-
export declare function resolveActiveSkills(projectRoot?: string): ResolvedSkill[];
|
|
46
|
+
export declare function resolveActiveSkills(projectRoot?: string, activation?: SkillActivationContext): ResolvedSkill[];
|
|
41
47
|
/**
|
|
42
48
|
* Resolve a single skill by name to its store paths, or null if not present.
|
|
43
49
|
* Resolution honors only the global store (single source of truth) and ignores
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export type TurnBaselineState = "running" | "completed" | "failed" | "cancelled";
|
|
2
|
+
export type FileChangeStatus = "added" | "modified" | "deleted" | "renamed" | "moved" | "copied" | "unchanged";
|
|
3
|
+
export type SnapshotKind = "missing" | "text" | "binary" | "directory" | "too-large";
|
|
4
|
+
export interface FileSnapshot {
|
|
5
|
+
exists: boolean;
|
|
6
|
+
kind: SnapshotKind;
|
|
7
|
+
sizeBytes?: number;
|
|
8
|
+
sha256?: string;
|
|
9
|
+
inlineContent?: string;
|
|
10
|
+
contentRef?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface TurnFileChange {
|
|
13
|
+
path: string;
|
|
14
|
+
previousPath?: string;
|
|
15
|
+
status: FileChangeStatus;
|
|
16
|
+
additions?: number;
|
|
17
|
+
deletions?: number;
|
|
18
|
+
before?: FileSnapshot;
|
|
19
|
+
after?: FileSnapshot;
|
|
20
|
+
}
|
|
21
|
+
export interface TurnChangeSummary {
|
|
22
|
+
turnId: string;
|
|
23
|
+
sessionId: string;
|
|
24
|
+
projectId: string;
|
|
25
|
+
state: TurnBaselineState;
|
|
26
|
+
startedAt: string;
|
|
27
|
+
completedAt?: string;
|
|
28
|
+
filesChanged: number;
|
|
29
|
+
files: TurnFileChange[];
|
|
30
|
+
truncated?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare function resolveProjectRelativePath(projectRoot: string, input: string): string | null;
|
|
33
|
+
export declare function startTurnBaseline(input: {
|
|
34
|
+
turnId: string;
|
|
35
|
+
sessionId: string;
|
|
36
|
+
projectId?: string;
|
|
37
|
+
workspaceDir?: string;
|
|
38
|
+
seedPaths?: unknown;
|
|
39
|
+
}): Promise<void>;
|
|
40
|
+
export declare function captureFileBefore(input: {
|
|
41
|
+
turnId?: string;
|
|
42
|
+
projectId?: string;
|
|
43
|
+
workspaceDir?: string;
|
|
44
|
+
path: string;
|
|
45
|
+
entryPath?: string;
|
|
46
|
+
previousPath?: string;
|
|
47
|
+
}): Promise<void>;
|
|
48
|
+
export declare function captureFileAfter(input: {
|
|
49
|
+
turnId?: string;
|
|
50
|
+
projectId?: string;
|
|
51
|
+
workspaceDir?: string;
|
|
52
|
+
path: string;
|
|
53
|
+
entryPath?: string;
|
|
54
|
+
previousPath?: string;
|
|
55
|
+
status?: FileChangeStatus;
|
|
56
|
+
}): Promise<void>;
|
|
57
|
+
export declare function captureAbsoluteBefore(input: {
|
|
58
|
+
turnId?: string;
|
|
59
|
+
workspaceDir: string;
|
|
60
|
+
absolutePath: string;
|
|
61
|
+
}): Promise<void>;
|
|
62
|
+
export declare function captureAbsoluteAfter(input: {
|
|
63
|
+
turnId?: string;
|
|
64
|
+
workspaceDir: string;
|
|
65
|
+
absolutePath: string;
|
|
66
|
+
status?: FileChangeStatus;
|
|
67
|
+
}): Promise<void>;
|
|
68
|
+
export declare function finalizeTurnBaseline(input: {
|
|
69
|
+
turnId: string;
|
|
70
|
+
state: TurnBaselineState;
|
|
71
|
+
}): Promise<TurnChangeSummary | null>;
|
|
72
|
+
export declare function getTurnBaselineSummary(projectId: string, turnId: string): Promise<TurnChangeSummary | null>;
|
|
73
|
+
export declare function listRecentTurnBaselines(input: {
|
|
74
|
+
projectId: string;
|
|
75
|
+
sessionId?: string;
|
|
76
|
+
limit?: number;
|
|
77
|
+
}): Promise<{
|
|
78
|
+
summaries: TurnChangeSummary[];
|
|
79
|
+
}>;
|
|
80
|
+
export declare function getTurnBaselineFileBaseline(input: {
|
|
81
|
+
projectId: string;
|
|
82
|
+
turnId: string;
|
|
83
|
+
path: string;
|
|
84
|
+
}): Promise<{
|
|
85
|
+
path: string;
|
|
86
|
+
content: string | null;
|
|
87
|
+
snapshot: FileSnapshot | null;
|
|
88
|
+
}>;
|
|
89
|
+
export declare function getTurnBaselineFileDiff(input: {
|
|
90
|
+
projectId: string;
|
|
91
|
+
turnId: string;
|
|
92
|
+
path: string;
|
|
93
|
+
}): Promise<{
|
|
94
|
+
path: string;
|
|
95
|
+
previousPath?: string;
|
|
96
|
+
status: FileChangeStatus;
|
|
97
|
+
original: string;
|
|
98
|
+
modified: string;
|
|
99
|
+
language?: string;
|
|
100
|
+
additions?: number;
|
|
101
|
+
deletions?: number;
|
|
102
|
+
}>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export type AgentMode = "chat" | "solo" | "product" | "workflow" | "unknown";
|
|
2
|
+
export interface TurnTelemetryUsage {
|
|
3
|
+
inputTokens?: number;
|
|
4
|
+
outputTokens?: number;
|
|
5
|
+
totalTokens?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface TurnTelemetryToolSummary {
|
|
8
|
+
calledTools: string[];
|
|
9
|
+
failedTools: string[];
|
|
10
|
+
blockedTools: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface TurnTelemetryFileContext {
|
|
13
|
+
changedFileCount?: number;
|
|
14
|
+
changedPathsPreview?: string[];
|
|
15
|
+
hasTurnFileChanges?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface TurnTelemetrySnapshot {
|
|
18
|
+
turnId: string;
|
|
19
|
+
sessionId: string;
|
|
20
|
+
projectId?: string;
|
|
21
|
+
/** Gateway-stamped alias; v1 MUST equal turnId (design §7.3). Set at finalize. */
|
|
22
|
+
assistantMessageId?: string;
|
|
23
|
+
model?: string;
|
|
24
|
+
provider?: string;
|
|
25
|
+
agentMode?: AgentMode;
|
|
26
|
+
sourceChannel?: string;
|
|
27
|
+
usage?: TurnTelemetryUsage;
|
|
28
|
+
toolSummary?: TurnTelemetryToolSummary;
|
|
29
|
+
fileContext?: TurnTelemetryFileContext;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
finalizedAt?: string;
|
|
32
|
+
}
|
|
33
|
+
/** Fields that can be merged into a turn's telemetry record as the turn progresses. */
|
|
34
|
+
export type TurnTelemetryPatch = Partial<Omit<TurnTelemetrySnapshot, "turnId" | "createdAt" | "finalizedAt" | "assistantMessageId">>;
|
|
35
|
+
/**
|
|
36
|
+
* Merge a telemetry fragment into the in-memory record for a turn. Pieces (tool summary,
|
|
37
|
+
* usage/model, file context) arrive at different points in the pipeline and upsert into the
|
|
38
|
+
* same turnId record. Safe to call before the projectId is known; the first call seeds it.
|
|
39
|
+
*/
|
|
40
|
+
export declare function recordTurnTelemetry(turnId: string, patch: TurnTelemetryPatch): void;
|
|
41
|
+
/**
|
|
42
|
+
* Flush the accumulated telemetry for a turn to disk and drop it from memory. Returns null
|
|
43
|
+
* (after dropping the in-memory record) when no projectId resolved — telemetry, like the turn
|
|
44
|
+
* baseline, is only persisted for turns that belong to a registered project.
|
|
45
|
+
*/
|
|
46
|
+
export declare function finalizeTurnTelemetry(input: {
|
|
47
|
+
turnId: string;
|
|
48
|
+
projectId?: string;
|
|
49
|
+
}): Promise<TurnTelemetrySnapshot | null>;
|
|
50
|
+
export declare function getTurnTelemetryRecord(projectId: string, turnId: string): Promise<TurnTelemetrySnapshot | null>;
|
|
51
|
+
export declare function listTurnTelemetryBySession(input: {
|
|
52
|
+
projectId: string;
|
|
53
|
+
sessionId?: string;
|
|
54
|
+
limit?: number;
|
|
55
|
+
}): Promise<{
|
|
56
|
+
records: TurnTelemetrySnapshot[];
|
|
57
|
+
}>;
|
|
58
|
+
/** Test/maintenance helper: drop any in-memory telemetry not yet finalized. */
|
|
59
|
+
export declare function __resetActiveTurnTelemetryForTest(): void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type WorkingMaterialKind = "workspace" | "instructions" | "generated" | "url";
|
|
2
|
+
export interface WorkingMaterialItem {
|
|
3
|
+
id: string;
|
|
4
|
+
projectId: string;
|
|
5
|
+
sessionId: string;
|
|
6
|
+
sourceKind: WorkingMaterialKind;
|
|
7
|
+
path?: string;
|
|
8
|
+
title: string;
|
|
9
|
+
viewerHint?: string;
|
|
10
|
+
pinned: boolean;
|
|
11
|
+
order: number;
|
|
12
|
+
addedAt: string;
|
|
13
|
+
updatedAt: string;
|
|
14
|
+
missing?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function getWorkingMaterials(projectId: string, sessionId: string): Promise<{
|
|
17
|
+
items: WorkingMaterialItem[];
|
|
18
|
+
missing: WorkingMaterialItem[];
|
|
19
|
+
}>;
|
|
20
|
+
export declare function replaceWorkingMaterials(projectId: string, sessionId: string, items: unknown[]): Promise<{
|
|
21
|
+
ok: true;
|
|
22
|
+
items: WorkingMaterialItem[];
|
|
23
|
+
}>;
|
|
24
|
+
export declare function upsertWorkingMaterial(projectId: string, sessionId: string, item: unknown): Promise<{
|
|
25
|
+
ok: true;
|
|
26
|
+
items: WorkingMaterialItem[];
|
|
27
|
+
}>;
|
|
28
|
+
export declare function removeWorkingMaterial(projectId: string, sessionId: string, id: string): Promise<{
|
|
29
|
+
ok: true;
|
|
30
|
+
items: WorkingMaterialItem[];
|
|
31
|
+
}>;
|
|
32
|
+
export declare function reorderWorkingMaterials(projectId: string, sessionId: string, ids: string[]): Promise<{
|
|
33
|
+
ok: true;
|
|
34
|
+
items: WorkingMaterialItem[];
|
|
35
|
+
}>;
|
|
@@ -35,6 +35,12 @@ export interface MemoryExtractionItem {
|
|
|
35
35
|
tags?: string[];
|
|
36
36
|
/** Ids of already-uploaded attachments to link to this memory on commit. */
|
|
37
37
|
attachmentIds?: string[];
|
|
38
|
+
/** Evidence trail for distillation-style sources (feedback — §10): audit refs + crash-safe dedup key. */
|
|
39
|
+
evidence?: {
|
|
40
|
+
kind: string;
|
|
41
|
+
refs: string[];
|
|
42
|
+
idempotencyKey: string;
|
|
43
|
+
};
|
|
38
44
|
}
|
|
39
45
|
export interface MemoryConsolidationWriteResult {
|
|
40
46
|
memoriesAdded?: number;
|
|
@@ -64,6 +64,7 @@ export interface ToolBootstrapConfig {
|
|
|
64
64
|
debug(message: string): void;
|
|
65
65
|
};
|
|
66
66
|
getTaskScopeKey?(): string | undefined;
|
|
67
|
+
getCurrentTurnId?(): string | undefined;
|
|
67
68
|
onExecProgress?(progress: ToolBootstrapProgress): void;
|
|
68
69
|
}
|
|
69
70
|
export interface ToolBootstrap {
|
|
@@ -21,5 +21,19 @@ export declare function getFreshWorkspaceEvidencePolicy(messages: readonly Promp
|
|
|
21
21
|
export declare function looksLikeBuildIntent(messages: readonly PromptMessageLike[] | string): boolean;
|
|
22
22
|
export declare function isLightweightChatTurn(messages: readonly PromptMessageLike[] | string): boolean;
|
|
23
23
|
export declare function isExplicitNoToolTurn(messages: readonly PromptMessageLike[] | string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Orchestration / capability primitives that survive every evidence filter.
|
|
26
|
+
* The policy's job is to FORCE fresh-evidence tools into the turn, not to
|
|
27
|
+
* strip the coordination layer — removing task/agent here silently breaks
|
|
28
|
+
* sub-agent delegation and background-task tracking on any turn whose text
|
|
29
|
+
* happens to match an evidence pattern (e.g. "write reports/x.json").
|
|
30
|
+
* `skill_view` belongs here for the same reason: it is the capability-invocation
|
|
31
|
+
* primitive, and the `# Available Skills` section tells the model to call it.
|
|
32
|
+
* Stripping `skill_view` on a file/mutation/shell turn (i.e. almost every real task)
|
|
33
|
+
* makes that instruction impossible to follow — the model cannot call a tool it
|
|
34
|
+
* was never given — which was the entire "skills never self-activate" bug.
|
|
35
|
+
* (skills_list / skill_manage are not load-bearing for self-activation, so they
|
|
36
|
+
* stay subject to the normal evidence filter.)
|
|
37
|
+
*/
|
|
24
38
|
export declare function selectFreshWorkspaceEvidenceTools<TTool extends ToolNameLike>(tools: readonly TTool[], policy: FreshWorkspaceEvidencePolicy): TTool[];
|
|
25
39
|
export declare function createFreshWorkspaceEvidenceSection(policy: FreshWorkspaceEvidencePolicy): SystemPromptSection | null;
|
|
@@ -21,10 +21,19 @@ export interface McpServerEntry {
|
|
|
21
21
|
url?: string;
|
|
22
22
|
/** Extra HTTP headers (http only) */
|
|
23
23
|
headers?: Record<string, string>;
|
|
24
|
-
/** Init timeout (ms) — accepted for config compatibility; mcporter owns connect timeouts. */
|
|
25
|
-
initTimeoutMs?: number;
|
|
26
24
|
/** Whether this server is disabled (skip connection) */
|
|
27
25
|
disabled?: boolean;
|
|
26
|
+
/** Allow the MCP runtime to start an OAuth flow for this server; default is cached-token/headless only. */
|
|
27
|
+
oauth?: boolean;
|
|
28
|
+
/** Optional tool-name allow/deny filters applied after connect-time discovery. */
|
|
29
|
+
tools?: {
|
|
30
|
+
include?: string[];
|
|
31
|
+
exclude?: string[];
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export interface McpSecurityIssue {
|
|
35
|
+
code: "dangerous_egress" | "persistence" | "ioc_public_key";
|
|
36
|
+
message: string;
|
|
28
37
|
}
|
|
29
38
|
export interface McpManagerConfig {
|
|
30
39
|
servers: McpServerEntry[];
|
|
@@ -37,6 +46,17 @@ export interface McpManagerConfig {
|
|
|
37
46
|
/** Runtime-owned catalog used for dynamic MCP tool injection. */
|
|
38
47
|
toolCatalog?: ToolRegistryLike;
|
|
39
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Run `attempt` up to `options.attempts` times, backing off `baseDelayMs * n`
|
|
51
|
+
* between tries. Returns the first success; rethrows the last error if every
|
|
52
|
+
* attempt fails. `sleep` is injectable so callers (and tests) control timing.
|
|
53
|
+
*/
|
|
54
|
+
export declare function connectWithRetry<T>(attempt: () => Promise<T>, options: {
|
|
55
|
+
attempts: number;
|
|
56
|
+
baseDelayMs: number;
|
|
57
|
+
sleep?: (ms: number) => Promise<void>;
|
|
58
|
+
onRetry?: (attemptNumber: number, err: unknown) => void;
|
|
59
|
+
}): Promise<T>;
|
|
40
60
|
export declare class McpManager {
|
|
41
61
|
private runtime;
|
|
42
62
|
private definitions;
|
|
@@ -45,6 +65,8 @@ export declare class McpManager {
|
|
|
45
65
|
private log;
|
|
46
66
|
private workspaceRoot?;
|
|
47
67
|
private toolCatalog?;
|
|
68
|
+
private serverToolFilters;
|
|
69
|
+
private serverOAuth;
|
|
48
70
|
constructor(config: McpManagerConfig);
|
|
49
71
|
private toServerDefinition;
|
|
50
72
|
/**
|
|
@@ -56,6 +78,7 @@ export declare class McpManager {
|
|
|
56
78
|
* Register all snapshotted MCP tools into the tool pool.
|
|
57
79
|
*/
|
|
58
80
|
injectTools(): void;
|
|
81
|
+
refreshServerTools(serverName: string): Promise<number>;
|
|
59
82
|
/** Get names of all connected servers. */
|
|
60
83
|
getConnectedServers(): string[];
|
|
61
84
|
/** Get total number of MCP tools across all servers. */
|
|
@@ -67,9 +90,15 @@ export declare class McpManager {
|
|
|
67
90
|
disconnectAll(): Promise<void>;
|
|
68
91
|
private toPortableTool;
|
|
69
92
|
private wrapToolsForWorkspaceBoundary;
|
|
93
|
+
private injectPortableTools;
|
|
94
|
+
private retractServerTools;
|
|
70
95
|
private registerTools;
|
|
71
96
|
private removeRegisteredTool;
|
|
72
97
|
}
|
|
73
98
|
export declare function validateMcpToolWorkspaceBoundary(toolName: string, args: unknown, workspaceRoot: string | undefined): string | null;
|
|
74
99
|
export declare function parseMcpConfig(json: unknown): McpServerEntry[];
|
|
100
|
+
export declare function filterMcpTools<T extends {
|
|
101
|
+
name: string;
|
|
102
|
+
}>(tools: readonly T[], filter?: McpServerEntry["tools"]): T[];
|
|
103
|
+
export declare function validateMcpServerSecurity(entry: McpServerEntry): McpSecurityIssue[];
|
|
75
104
|
export {};
|
|
@@ -162,7 +162,7 @@ export declare class LocalMemoryProvider implements MemoryProvider {
|
|
|
162
162
|
page?: number;
|
|
163
163
|
pageSize?: number;
|
|
164
164
|
activeOnly?: boolean;
|
|
165
|
-
}): import("./local-store.js").MemoryRecord[];
|
|
165
|
+
}): import("./local-store-records.js").MemoryRecord[];
|
|
166
166
|
/**
|
|
167
167
|
* Find memories by event date (+/- tolerance). For temporal context retrieval.
|
|
168
168
|
*/
|
|
@@ -178,8 +178,8 @@ export declare class LocalMemoryProvider implements MemoryProvider {
|
|
|
178
178
|
bucketCount?: number;
|
|
179
179
|
clusterLimit?: number;
|
|
180
180
|
activeOnly?: boolean;
|
|
181
|
-
}): import("./local-store.js").MemoryAtlasResult;
|
|
182
|
-
findByEventDate(userId: string, targetDate: string, toleranceDays?: number): import("./local-store.js").MemorySearchHit[];
|
|
181
|
+
}): import("./local-store-records.js").MemoryAtlasResult;
|
|
182
|
+
findByEventDate(userId: string, targetDate: string, toleranceDays?: number): import("./local-store-records.js").MemorySearchHit[];
|
|
183
183
|
/**
|
|
184
184
|
* Find related memories (event continuity detection).
|
|
185
185
|
* Given a new memory, finds existing memories that are semantically related
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/** Lightweight attachment reference carried on records / atlas wire (no bytes, no extractedText). */
|
|
2
|
+
export interface MemoryAttachmentRef {
|
|
3
|
+
id: string;
|
|
4
|
+
kind: string;
|
|
5
|
+
filename: string;
|
|
6
|
+
mimeType: string;
|
|
7
|
+
size: number;
|
|
8
|
+
url: string;
|
|
9
|
+
}
|
|
1
10
|
export interface MemoryRecord {
|
|
2
11
|
id: string;
|
|
3
12
|
text: string;
|
|
@@ -15,6 +24,8 @@ export interface MemoryRecord {
|
|
|
15
24
|
accessCount: number;
|
|
16
25
|
lastAccessedAt: number;
|
|
17
26
|
isArchived: boolean;
|
|
27
|
+
/** Lightweight attachment refs (populated by the provider for atlas/detail). */
|
|
28
|
+
attachments?: MemoryAttachmentRef[];
|
|
18
29
|
}
|
|
19
30
|
export interface MemoryInsertInput {
|
|
20
31
|
text: string;
|
|
@@ -84,7 +95,7 @@ export interface MemoryAtlasResult {
|
|
|
84
95
|
endAt: number;
|
|
85
96
|
} | null;
|
|
86
97
|
}
|
|
87
|
-
export type MemorySourceKind = "manual" | "explicit" | "document" | "image" | "video" | "auto" | "turn" | "dream" | "agent";
|
|
98
|
+
export type MemorySourceKind = "manual" | "explicit" | "document" | "image" | "video" | "auto" | "turn" | "dream" | "agent" | "feedback";
|
|
88
99
|
export type MemoryClaimStatus = "active" | "superseded" | "conflicted" | "archived" | "pending_confirmation";
|
|
89
100
|
export type MemoryProposalStatus = "pending" | "accepted" | "merged" | "conflicted" | "rejected";
|
|
90
101
|
export interface MemoryObservationInput {
|
|
@@ -119,6 +130,12 @@ export interface MemoryProposalInput {
|
|
|
119
130
|
tags?: string[];
|
|
120
131
|
status?: MemoryProposalStatus;
|
|
121
132
|
relatedClaimIds?: string[];
|
|
133
|
+
/**
|
|
134
|
+
* Crash-safe dedup key for evidence-bearing sources (feedback distillation — §10). When set,
|
|
135
|
+
* proposeExtracted skips inserting a duplicate proposal for the same key. Left undefined by all
|
|
136
|
+
* existing callers (LLM extraction / dream / manual), so their behaviour is unchanged.
|
|
137
|
+
*/
|
|
138
|
+
idempotencyKey?: string;
|
|
122
139
|
}
|
|
123
140
|
export interface MemoryProposalRecord extends Omit<MemoryProposalInput, "value" | "validTime" | "tags" | "status" | "relatedClaimIds"> {
|
|
124
141
|
id: string;
|