kc-beta 0.3.2 → 0.5.4
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/package.json +1 -1
- package/src/agent/confidence-scorer.js +8 -0
- package/src/agent/context-window.js +7 -2
- package/src/agent/context.js +25 -0
- package/src/agent/corner-case-registry.js +5 -0
- package/src/agent/engine.js +564 -76
- package/src/agent/event-log.js +15 -2
- package/src/agent/history.js +91 -23
- package/src/agent/pipelines/initializer.js +3 -6
- package/src/agent/retry.js +9 -1
- package/src/agent/rule-catalog-normalize.js +37 -0
- package/src/agent/scheduler.js +276 -0
- package/src/agent/session-state.js +11 -2
- package/src/agent/task-manager.js +5 -0
- package/src/agent/tools/agent-tool.js +57 -14
- package/src/agent/tools/archive-file.js +94 -0
- package/src/agent/tools/copy-to-workspace.js +140 -0
- package/src/agent/tools/phase-advance.js +60 -0
- package/src/agent/tools/release.js +323 -0
- package/src/agent/tools/rule-catalog.js +56 -4
- package/src/agent/tools/schedule-fetch.js +118 -0
- package/src/agent/tools/snapshot.js +101 -0
- package/src/agent/tools/workspace-file.js +10 -7
- package/src/agent/version-manager.js +29 -120
- package/src/agent/workspace.js +127 -4
- package/src/cli/components.js +68 -12
- package/src/cli/index.js +147 -15
- package/src/config.js +10 -1
- package/src/model-tiers.json +5 -5
- package/template/release-runtime/README.md.tmpl +84 -0
- package/template/release-runtime/kc_runtime/__init__.py +2 -0
- package/template/release-runtime/kc_runtime/confidence.py +93 -0
- package/template/release-runtime/kc_runtime/dashboard.py +208 -0
- package/template/release-runtime/render_dashboard.py +49 -0
- package/template/release-runtime/run.py +230 -0
- package/template/release-runtime/serve.sh +15 -0
- package/template/skills/en/meta-meta/bootstrap-workspace/SKILL.md +11 -0
- package/template/skills/en/meta-meta/quality-control/SKILL.md +13 -1
- package/template/skills/en/meta-meta/skill-to-workflow/SKILL.md +8 -0
- package/template/skills/en/meta-meta/task-decomposition/SKILL.md +13 -0
- package/template/skills/en/meta-meta/version-control/SKILL.md +13 -0
- package/template/skills/zh/meta-meta/bootstrap-workspace/SKILL.md +11 -0
- package/template/skills/zh/meta-meta/quality-control/SKILL.md +12 -0
- package/template/skills/zh/meta-meta/skill-to-workflow/SKILL.md +8 -0
- package/template/skills/zh/meta-meta/task-decomposition/SKILL.md +16 -0
- package/template/skills/zh/meta-meta/version-control/SKILL.md +13 -0
- package/template/workspace.gitignore +22 -0
package/package.json
CHANGED
|
@@ -30,6 +30,14 @@ export class ConfidenceScorer {
|
|
|
30
30
|
this._loadCalibration();
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
/** Re-point at a new workspace. Used by `engine.renameSession()` (Bug 3). */
|
|
34
|
+
_setWorkspacePath(newWorkspacePath) {
|
|
35
|
+
this._workspace = newWorkspacePath;
|
|
36
|
+
this._calibrationPath = path.join(newWorkspacePath, "confidence_calibration.json");
|
|
37
|
+
// Re-load priors from the new workspace's .env (in case it was edited externally)
|
|
38
|
+
this._loadConfig();
|
|
39
|
+
}
|
|
40
|
+
|
|
33
41
|
_loadConfig() {
|
|
34
42
|
const envPath = path.join(this._workspace, ".env");
|
|
35
43
|
if (!fs.existsSync(envPath)) return;
|
|
@@ -12,10 +12,15 @@ export class ContextWindow {
|
|
|
12
12
|
* @param {number} [opts.reserveForResponse=8192] - Tokens reserved for model output
|
|
13
13
|
* @param {number} [opts.recentWindowSize=30] - Number of recent messages to always keep
|
|
14
14
|
*/
|
|
15
|
-
constructor({ contextLimit, reserveForResponse = 8192, recentWindowSize = 30 }) {
|
|
15
|
+
constructor({ contextLimit, reserveForResponse = 8192, recentWindowSize = 30, triggerFraction = 0.70 }) {
|
|
16
16
|
this.contextLimit = contextLimit;
|
|
17
17
|
this.reserveForResponse = reserveForResponse;
|
|
18
18
|
this.recentWindowSize = recentWindowSize;
|
|
19
|
+
// Fraction of budget that triggers windowing. v0.5.3 used 0.85 which only
|
|
20
|
+
// fired after runtime was already deep in the danger zone (a subsequent
|
|
21
|
+
// tool result could tip it over before the next check). 0.70 leaves room
|
|
22
|
+
// for one more tool result before hitting the hard ceiling.
|
|
23
|
+
this.triggerFraction = triggerFraction;
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
/**
|
|
@@ -29,7 +34,7 @@ export class ContextWindow {
|
|
|
29
34
|
const budget = this.contextLimit - this.reserveForResponse;
|
|
30
35
|
|
|
31
36
|
// If within budget, return as-is
|
|
32
|
-
if (totalTokens <= budget *
|
|
37
|
+
if (totalTokens <= budget * this.triggerFraction) {
|
|
33
38
|
return { messages, wasWindowed: false, removedCount: 0 };
|
|
34
39
|
}
|
|
35
40
|
|
package/src/agent/context.js
CHANGED
|
@@ -68,6 +68,31 @@ during execution with high-threshold matching, not patched into main workflows.
|
|
|
68
68
|
based on extraction method, source text presence, historical accuracy, and corner \
|
|
69
69
|
case proximity. Confidence bands (high/medium/low) drive QC sampling rates.
|
|
70
70
|
|
|
71
|
+
## File System
|
|
72
|
+
|
|
73
|
+
Your workspace is a git repository. Every write to a tracked path (skills, \
|
|
74
|
+
workflows, rules, glossary, AGENT.md, tasks.json) is auto-committed with a \
|
|
75
|
+
trace ID. Use \`sandbox_exec\` with \`cwd: "workspace"\` to run git directly: \
|
|
76
|
+
\`git log --oneline\`, \`git diff HEAD~3 -- rule_skills/R001/\`, \
|
|
77
|
+
\`git checkout HEAD~5 -- rule_skills/R001/\`. High-volume runtime data \
|
|
78
|
+
(logs/, sub_agents/, input/, output/, samples/) is gitignored — git status \
|
|
79
|
+
shows only meaningful changes.
|
|
80
|
+
|
|
81
|
+
Large tool outputs (above ~2000 tokens) are automatically offloaded — you'll \
|
|
82
|
+
see a digest with \`[…truncated, full at: logs/tool_results/<id>.txt …]\`. \
|
|
83
|
+
Read the full file with \`workspace_file\` only if you need the detail. The \
|
|
84
|
+
event log keeps the full output regardless, so audits never lose data.
|
|
85
|
+
|
|
86
|
+
Three workspace tools beyond \`workspace_file\` and \`sandbox_exec\`:
|
|
87
|
+
- \`copy_to_workspace\` — pull a specific file from the project dir into \
|
|
88
|
+
\`refs/\` when you need a workspace-local working copy. Default is to read \
|
|
89
|
+
project files in place via \`scope: "project"\`; only copy when you genuinely need to.
|
|
90
|
+
- \`snapshot\` — freeze the current workspace state (git tag + manifest). Use \
|
|
91
|
+
before risky operations or for release bundles.
|
|
92
|
+
- \`archive_file\` — move a file to an \`archived/\` subdirectory next to it. \
|
|
93
|
+
Use after a workflow consumes an input doc, or when an old result is no longer \
|
|
94
|
+
the primary view.
|
|
95
|
+
|
|
71
96
|
## Working with the Developer User
|
|
72
97
|
|
|
73
98
|
The developer user configures the project, provides regulations and samples, and \
|
|
@@ -18,6 +18,11 @@ export class CornerCaseRegistry {
|
|
|
18
18
|
this._load();
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/** Re-point at a new workspace. Used by `engine.renameSession()` (Bug 3). */
|
|
22
|
+
_setWorkspacePath(newWorkspacePath) {
|
|
23
|
+
this._path = path.join(newWorkspacePath, "corner_cases.json");
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
_load() {
|
|
22
27
|
if (!fs.existsSync(this._path)) return;
|
|
23
28
|
try {
|