dsh-fast 0.1.3 → 0.2.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/CHANGELOG.md +6 -0
- package/README.es.md +3 -1
- package/README.hi.md +3 -1
- package/README.md +3 -1
- package/README.pt.md +3 -1
- package/README.zh.md +3 -1
- package/lib/index.js +224 -15
- package/lib/types/analyze.d.ts.map +1 -1
- package/lib/types/analyze.js +6 -0
- package/lib/types/analyze.js.map +1 -1
- package/lib/types/collector.d.ts +5 -1
- package/lib/types/collector.d.ts.map +1 -1
- package/lib/types/collector.js +14 -2
- package/lib/types/collector.js.map +1 -1
- package/lib/types/estimate.d.ts +19 -2
- package/lib/types/estimate.d.ts.map +1 -1
- package/lib/types/estimate.js +49 -2
- package/lib/types/estimate.js.map +1 -1
- package/lib/types/index.d.ts +2 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +34 -8
- package/lib/types/index.js.map +1 -1
- package/lib/types/model.d.ts +23 -1
- package/lib/types/model.d.ts.map +1 -1
- package/lib/types/store.d.ts +22 -0
- package/lib/types/store.d.ts.map +1 -1
- package/lib/types/store.js +14 -0
- package/lib/types/store.js.map +1 -1
- package/lib/types/version.d.ts +1 -1
- package/lib/types/version.js +1 -1
- package/package.json +1 -1
- package/src/analyze.ts +6 -0
- package/src/collector.ts +16 -2
- package/src/estimate.ts +54 -2
- package/src/index.ts +41 -8
- package/src/model.ts +25 -1
- package/src/store.ts +16 -0
- package/src/version.ts +1 -1
package/src/model.ts
CHANGED
|
@@ -44,11 +44,33 @@ export interface CompactionStats {
|
|
|
44
44
|
shadowedTokens: number
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
/** One named bucket of the injected system prompt. */
|
|
48
|
+
export interface PromptBucket {
|
|
49
|
+
/** Heuristic token estimate for this bucket (`ceil(chars / 4)`). */
|
|
50
|
+
tokens: number
|
|
51
|
+
/** Raw character count of the bucket's sections. */
|
|
52
|
+
chars: number
|
|
53
|
+
/** Fraction of the total system-prompt bucket tokens (0 when the total is 0). */
|
|
54
|
+
share: number
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** The system-prompt breakdown: AGENTS.md / skills / persona / other named sections. */
|
|
58
|
+
export interface SystemPromptBreakdown {
|
|
59
|
+
/** Sections that carry agent instructions (AGENTS.md-style). */
|
|
60
|
+
agentsMd: PromptBucket
|
|
61
|
+
/** Sections that carry skill content. */
|
|
62
|
+
skills: PromptBucket
|
|
63
|
+
/** The `deployment:persona` section. */
|
|
64
|
+
persona: PromptBucket
|
|
65
|
+
/** Harness identity, tool guidance, and any unclassified sections. */
|
|
66
|
+
other: PromptBucket
|
|
67
|
+
}
|
|
68
|
+
|
|
47
69
|
/** Context-injection volume: where the request context's tokens live. */
|
|
48
70
|
export interface ContextStats {
|
|
49
71
|
/** Canonical current pressure (token-meter total), or the heuristic header+surface sum. */
|
|
50
72
|
totalTokens: number
|
|
51
|
-
/** Assembled system-prompt tokens —
|
|
73
|
+
/** Assembled system-prompt tokens — harness identity, persona, tool guidance, and plugin sections. */
|
|
52
74
|
systemTokens: number
|
|
53
75
|
/** Tool-schema tokens. */
|
|
54
76
|
toolSchemaTokens: number
|
|
@@ -60,6 +82,8 @@ export interface ContextStats {
|
|
|
60
82
|
toolsShare: number
|
|
61
83
|
/** `surfaceTokens / totalTokens` (0 when the total is 0). */
|
|
62
84
|
surfaceShare: number
|
|
85
|
+
/** Per-section system-prompt breakdown (AGENTS.md / skills / persona / other). */
|
|
86
|
+
systemBreakdown: SystemPromptBreakdown
|
|
63
87
|
}
|
|
64
88
|
|
|
65
89
|
/** LLM cache accounting aggregated from `assistant/message` usage. */
|
package/src/store.ts
CHANGED
|
@@ -33,6 +33,21 @@ const compactionSchema = z.object({
|
|
|
33
33
|
shadowedTokens: z.number().int().nonnegative(),
|
|
34
34
|
})
|
|
35
35
|
|
|
36
|
+
/** Zod schema for one prompt bucket. */
|
|
37
|
+
const bucketSchema = z.object({
|
|
38
|
+
tokens: z.number().nonnegative(),
|
|
39
|
+
chars: z.number().nonnegative(),
|
|
40
|
+
share: z.number(),
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
/** Zod schema for the system-prompt breakdown. */
|
|
44
|
+
const breakdownSchema = z.object({
|
|
45
|
+
agentsMd: bucketSchema,
|
|
46
|
+
skills: bucketSchema,
|
|
47
|
+
persona: bucketSchema,
|
|
48
|
+
other: bucketSchema,
|
|
49
|
+
})
|
|
50
|
+
|
|
36
51
|
/** Zod schema for the context section. */
|
|
37
52
|
const contextSchema = z.object({
|
|
38
53
|
totalTokens: z.number().nonnegative(),
|
|
@@ -42,6 +57,7 @@ const contextSchema = z.object({
|
|
|
42
57
|
systemShare: z.number(),
|
|
43
58
|
toolsShare: z.number(),
|
|
44
59
|
surfaceShare: z.number(),
|
|
60
|
+
systemBreakdown: breakdownSchema,
|
|
45
61
|
})
|
|
46
62
|
|
|
47
63
|
/** Zod schema for the cache section. */
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Single-source plugin version, bumped by `scripts/release.mjs`. @module dsh-fast/version */
|
|
2
|
-
export const VERSION = '0.
|
|
2
|
+
export const VERSION = '0.2.0'
|