qlogicagent 2.9.0 → 2.10.1
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 +16 -16
- package/dist/cli.js +309 -238
- package/dist/index.js +334 -263
- package/dist/protocol.js +1 -1
- package/dist/types/cli/handlers/memory-handler.d.ts +10 -0
- package/dist/types/cli/handlers/pet-handler.d.ts +8 -1
- package/dist/types/cli/handlers/settings-handler.d.ts +3 -15
- package/dist/types/cli/handlers/settings-handler.remote-catalog.test.d.ts +1 -0
- package/dist/types/cli/stdio-server.d.ts +26 -0
- package/dist/types/protocol/wire/agent-events.d.ts +2 -2
- package/dist/types/protocol/wire/gateway-rpc.d.ts +48 -0
- package/dist/types/protocol/wire/notification-payloads.d.ts +7 -0
- package/dist/types/runtime/infra/llmrouter-catalog.d.ts +49 -0
- package/dist/types/runtime/infra/model-registry.d.ts +36 -101
- package/dist/types/runtime/pet/index.d.ts +2 -0
- package/dist/types/runtime/pet/pet-consistency.d.ts +79 -0
- package/dist/types/runtime/pet/pet-skeleton.d.ts +70 -0
- package/dist/types/skills/memory/local-memory-provider.d.ts +10 -0
- package/package.json +1 -1
- package/dist/types/runtime/infra/builtin-providers.d.ts +0 -36
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pet Consistency Scorer — Vision model evaluation for character consistency (design §14.4).
|
|
3
|
+
*
|
|
4
|
+
* After generating SVGs (via skeleton or direct LLM), this module:
|
|
5
|
+
* 1. Renders each SVG state to compare against the reference/base
|
|
6
|
+
* 2. Uses Vision model to score visual consistency (0-10)
|
|
7
|
+
* 3. Retries generation if score < threshold
|
|
8
|
+
*
|
|
9
|
+
* Strategies used:
|
|
10
|
+
* - Structured Prompt: fixed character description + only vary action
|
|
11
|
+
* - Post-processing validation: Vision model scores after generation
|
|
12
|
+
* - Part presence check: verify required DOM structure exists
|
|
13
|
+
*/
|
|
14
|
+
export interface ConsistencyResult {
|
|
15
|
+
state: string;
|
|
16
|
+
score: number;
|
|
17
|
+
passed: boolean;
|
|
18
|
+
feedback?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ConsistencyReport {
|
|
21
|
+
overallScore: number;
|
|
22
|
+
results: ConsistencyResult[];
|
|
23
|
+
passedAll: boolean;
|
|
24
|
+
retryStates: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface ConsistencyOptions {
|
|
27
|
+
/** Minimum score to pass (0-10). Default: 6 */
|
|
28
|
+
threshold?: number;
|
|
29
|
+
/** Max retries per state. Default: 2 */
|
|
30
|
+
maxRetries?: number;
|
|
31
|
+
/** Reference SVG (base/idle state) to compare against */
|
|
32
|
+
referenceSvg: string;
|
|
33
|
+
/** Character description for context */
|
|
34
|
+
characterDesc: string;
|
|
35
|
+
}
|
|
36
|
+
declare const DEFAULT_THRESHOLD = 6;
|
|
37
|
+
declare const DEFAULT_MAX_RETRIES = 2;
|
|
38
|
+
/**
|
|
39
|
+
* Quick structural check: verify the SVG has consistent DOM structure.
|
|
40
|
+
* Returns a score 0-10 based on structural similarity to reference.
|
|
41
|
+
*/
|
|
42
|
+
export declare function structuralConsistencyScore(referenceSvg: string, candidateSvg: string): number;
|
|
43
|
+
/**
|
|
44
|
+
* Build the Vision model prompt for consistency scoring.
|
|
45
|
+
*/
|
|
46
|
+
export declare function buildConsistencyPrompt(characterDesc: string, stateName: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* Parse Vision model response to extract score and feedback.
|
|
49
|
+
*/
|
|
50
|
+
export declare function parseConsistencyResponse(response: string): {
|
|
51
|
+
score: number;
|
|
52
|
+
feedback: string;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Run the full consistency check pipeline.
|
|
56
|
+
* Takes generated SVGs, scores each against reference, returns report.
|
|
57
|
+
*
|
|
58
|
+
* The `visionScore` callback is optional — if not provided, only structural
|
|
59
|
+
* scoring is used (faster, no LLM cost, but less accurate).
|
|
60
|
+
*/
|
|
61
|
+
export declare function evaluateConsistency(referenceSvg: string, stateSvgs: Record<string, string>, options?: {
|
|
62
|
+
threshold?: number;
|
|
63
|
+
}): ConsistencyReport;
|
|
64
|
+
/**
|
|
65
|
+
* Async consistency evaluation using Vision model for high-accuracy scoring.
|
|
66
|
+
* Falls back to structural scoring if Vision call fails.
|
|
67
|
+
*/
|
|
68
|
+
export declare function evaluateConsistencyWithVision(referenceSvg: string, stateSvgs: Record<string, string>, visionScore: (referenceSvg: string, candidateSvg: string, state: string) => Promise<{
|
|
69
|
+
score: number;
|
|
70
|
+
feedback: string;
|
|
71
|
+
}>, options?: {
|
|
72
|
+
threshold?: number;
|
|
73
|
+
}): Promise<ConsistencyReport>;
|
|
74
|
+
/**
|
|
75
|
+
* Retry strategy: regenerate failed states with enhanced prompt.
|
|
76
|
+
* Returns a prompt modifier string that emphasizes consistency.
|
|
77
|
+
*/
|
|
78
|
+
export declare function buildRetryPrompt(characterDesc: string, state: string, feedback: string, attempt: number): string;
|
|
79
|
+
export { DEFAULT_THRESHOLD, DEFAULT_MAX_RETRIES };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PetSkeleton — SVG skeleton parameterization system (design §14.3 Plan A).
|
|
3
|
+
*
|
|
4
|
+
* Core idea: generate ONE base skeleton via LLM, then render each state by
|
|
5
|
+
* only varying animation parameters (pose, expression, effects).
|
|
6
|
+
* This ensures visual consistency across states without repeated LLM calls.
|
|
7
|
+
*
|
|
8
|
+
* Pipeline:
|
|
9
|
+
* 1. LLM generates a base SVG skeleton with labeled parts
|
|
10
|
+
* 2. We parse and decompose it into movable parts
|
|
11
|
+
* 3. Each state applies different CSS @keyframes to the same skeleton
|
|
12
|
+
*/
|
|
13
|
+
export interface PetSkeleton {
|
|
14
|
+
/** Raw SVG of the base pose (idle-like neutral pose) */
|
|
15
|
+
baseSvg: string;
|
|
16
|
+
/** Extracted part IDs found in the SVG */
|
|
17
|
+
parts: SkeletonPart[];
|
|
18
|
+
/** Color palette extracted from the base SVG */
|
|
19
|
+
colors: {
|
|
20
|
+
primary: string;
|
|
21
|
+
secondary: string;
|
|
22
|
+
accent?: string;
|
|
23
|
+
};
|
|
24
|
+
/** Character description used to generate this skeleton */
|
|
25
|
+
characterDesc: string;
|
|
26
|
+
}
|
|
27
|
+
export interface SkeletonPart {
|
|
28
|
+
id: string;
|
|
29
|
+
type: "body" | "head" | "left-eye" | "right-eye" | "left-arm" | "right-arm" | "accessory" | "effect";
|
|
30
|
+
/** CSS selector for this part within the SVG */
|
|
31
|
+
selector: string;
|
|
32
|
+
}
|
|
33
|
+
export interface StateAnimationParams {
|
|
34
|
+
body: BodyAnimation;
|
|
35
|
+
eyes: EyeExpression;
|
|
36
|
+
arms: ArmPose;
|
|
37
|
+
effects?: EffectOverlay[];
|
|
38
|
+
}
|
|
39
|
+
export type BodyAnimation = "breathe" | "sway" | "lean" | "tilt" | "shrink" | "bounce" | "still" | "float";
|
|
40
|
+
export type EyeExpression = "blink" | "lookup" | "focus" | "closed" | "wide" | "sparkle" | "dizzy" | "sleepy";
|
|
41
|
+
export type ArmPose = "sway" | "still" | "hammer" | "wave" | "raised" | "covering" | "hold" | "eat";
|
|
42
|
+
export type EffectOverlay = "zzz" | "sparkle" | "sweat" | "question" | "ellipsis" | "heart" | "exclaim" | "music";
|
|
43
|
+
export declare const STATE_ANIMATION_MAP: Record<string, StateAnimationParams>;
|
|
44
|
+
/**
|
|
45
|
+
* Generate the base skeleton prompt for LLM.
|
|
46
|
+
* The LLM generates ONE SVG with labeled groups that we can animate differently per state.
|
|
47
|
+
*/
|
|
48
|
+
export declare function buildSkeletonPrompt(characterDesc: string): string;
|
|
49
|
+
/**
|
|
50
|
+
* Parse a skeleton SVG and identify parts.
|
|
51
|
+
*/
|
|
52
|
+
export declare function parseSkeleton(svgText: string): SkeletonPart[];
|
|
53
|
+
/**
|
|
54
|
+
* Render a specific state by injecting CSS animations into the skeleton SVG.
|
|
55
|
+
* The skeleton remains identical — only the <style> block changes.
|
|
56
|
+
*/
|
|
57
|
+
export declare function renderState(skeleton: PetSkeleton, state: string): string;
|
|
58
|
+
/**
|
|
59
|
+
* Extract primary/secondary colors from an SVG string.
|
|
60
|
+
* Looks for fill/stop-color attributes and picks the two most frequent.
|
|
61
|
+
*/
|
|
62
|
+
export declare function extractColors(svgText: string): {
|
|
63
|
+
primary: string;
|
|
64
|
+
secondary: string;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Validate that a skeleton SVG has the required part structure.
|
|
68
|
+
* Returns list of missing parts (empty = valid).
|
|
69
|
+
*/
|
|
70
|
+
export declare function validateSkeleton(svgText: string): string[];
|
|
@@ -116,6 +116,16 @@ export declare class LocalMemoryProvider implements MemoryProvider {
|
|
|
116
116
|
date: string;
|
|
117
117
|
}>;
|
|
118
118
|
};
|
|
119
|
+
/**
|
|
120
|
+
* List full memory records for a user (paginated). Used by the memory atlas
|
|
121
|
+
* visualization, which needs the complete record shape (confidence, importance,
|
|
122
|
+
* accessCount, timestamps, tags) to drive its 3D rendering.
|
|
123
|
+
*/
|
|
124
|
+
list(userId: string, options?: {
|
|
125
|
+
page?: number;
|
|
126
|
+
pageSize?: number;
|
|
127
|
+
activeOnly?: boolean;
|
|
128
|
+
}): import("./local-store.js").MemoryRecord[];
|
|
119
129
|
/**
|
|
120
130
|
* Find memories by event date (±tolerance). For temporal context retrieval.
|
|
121
131
|
*/
|
package/package.json
CHANGED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Supported provider metadata for settings RPC.
|
|
3
|
-
*
|
|
4
|
-
* Bridges provider-core's BUILTIN_PROVIDERS into the ModelPurpose system.
|
|
5
|
-
* This is the authoritative list of providers shown in "Add Key" UI.
|
|
6
|
-
*
|
|
7
|
-
* IMPORTANT: Model lists here are the Layer 2 (offline fallback) data source.
|
|
8
|
-
* Layer 1 is ModelCatalog (models.dev remote). These two are the ONLY sources.
|
|
9
|
-
*/
|
|
10
|
-
import type { ModelPurpose } from "./model-registry.js";
|
|
11
|
-
export interface KnownModelMeta {
|
|
12
|
-
model: string;
|
|
13
|
-
displayName: string;
|
|
14
|
-
purposes: ModelPurpose[];
|
|
15
|
-
baseUrl?: string;
|
|
16
|
-
}
|
|
17
|
-
export interface SupportedProviderMeta {
|
|
18
|
-
id: string;
|
|
19
|
-
displayName: string;
|
|
20
|
-
baseUrl: string;
|
|
21
|
-
defaultRateLimit?: {
|
|
22
|
-
rpm?: number;
|
|
23
|
-
tpm?: number;
|
|
24
|
-
};
|
|
25
|
-
knownModels: KnownModelMeta[];
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Minimal offline fallback providers.
|
|
29
|
-
* Remote catalog (Layer 1) has text generation models; this Layer 2 keeps ONLY
|
|
30
|
-
* specialized models that remote may not cover: embedding, TTS, STT, image gen,
|
|
31
|
-
* video gen, music gen, 3D gen, realtime voice/video, voice clone.
|
|
32
|
-
*
|
|
33
|
-
* All providers are kept (for Add Key UI dropdown + baseUrl lookup).
|
|
34
|
-
* Text generation / image understanding models are NOT listed here — remote always has them.
|
|
35
|
-
*/
|
|
36
|
-
export declare const SUPPORTED_PROVIDERS: SupportedProviderMeta[];
|