kiokuko-dsh 0.2.26 → 0.2.28
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/context/replay-model-memory.d.ts +2 -2
- package/dist/context/replay-model-memory.d.ts.map +1 -1
- package/dist/context/replay-model-memory.js +70 -16
- package/dist/context/replay-model-memory.js.map +1 -1
- package/dist/dsh/agenticreplay-host.d.ts.map +1 -1
- package/dist/dsh/agenticreplay-host.js +5 -1
- package/dist/dsh/agenticreplay-host.js.map +1 -1
- package/dist/dsh/agenticreplay-libraries.d.ts +1 -0
- package/dist/dsh/agenticreplay-libraries.d.ts.map +1 -1
- package/dist/dsh/agenticreplay-libraries.js.map +1 -1
- package/dist/dsh/agenticreplay-recorder.d.ts.map +1 -1
- package/dist/dsh/agenticreplay-recorder.js +22 -10
- package/dist/dsh/agenticreplay-recorder.js.map +1 -1
- package/dist/dsh/agenticreplay-security.d.ts.map +1 -1
- package/dist/dsh/agenticreplay-security.js +40 -6
- package/dist/dsh/agenticreplay-security.js.map +1 -1
- package/dist/dsh/agenticreplay-types.d.ts +3 -0
- package/dist/dsh/agenticreplay-types.d.ts.map +1 -1
- package/dist/dsh/agenticreplay-types.js.map +1 -1
- package/dist/dsh/coding-workflow/host.d.ts +1 -0
- package/dist/dsh/coding-workflow/host.d.ts.map +1 -1
- package/dist/dsh/coding-workflow/host.js +10 -0
- package/dist/dsh/coding-workflow/host.js.map +1 -1
- package/dist/dsh/coding-workflow/service.d.ts +6 -2
- package/dist/dsh/coding-workflow/service.d.ts.map +1 -1
- package/dist/dsh/coding-workflow/service.js +6 -5
- package/dist/dsh/coding-workflow/service.js.map +1 -1
- package/dist/dsh/core/host.d.ts.map +1 -1
- package/dist/dsh/core/host.js +10 -1
- package/dist/dsh/core/host.js.map +1 -1
- package/dist/dsh/execution-support.d.ts.map +1 -1
- package/dist/dsh/execution-support.js +2 -0
- package/dist/dsh/execution-support.js.map +1 -1
- package/dist/dsh/host-adapter/lifecycle.d.ts +20 -18
- package/dist/dsh/host-adapter/lifecycle.d.ts.map +1 -1
- package/dist/dsh/host-adapter/lifecycle.js +298 -102
- package/dist/dsh/host-adapter/lifecycle.js.map +1 -1
- package/dist/dsh/host-adapter.d.ts +47 -47
- package/dist/dsh/host-adapter.d.ts.map +1 -1
- package/dist/dsh/host-adapter.js +1213 -592
- package/dist/dsh/host-adapter.js.map +1 -1
- package/dist/dsh/index.d.ts +42 -41
- package/dist/dsh/index.d.ts.map +1 -1
- package/dist/dsh/index.js +166 -92
- package/dist/dsh/index.js.map +1 -1
- package/dist/dsh/lifecycle-memory.d.ts +12 -7
- package/dist/dsh/lifecycle-memory.d.ts.map +1 -1
- package/dist/dsh/lifecycle-memory.js +606 -172
- package/dist/dsh/lifecycle-memory.js.map +1 -1
- package/dist/dsh/memory-application.d.ts +9 -9
- package/dist/dsh/memory-application.d.ts.map +1 -1
- package/dist/dsh/memory-application.js +448 -147
- package/dist/dsh/memory-application.js.map +1 -1
- package/dist/dsh/on-demand-intake.d.ts +13 -0
- package/dist/dsh/on-demand-intake.d.ts.map +1 -1
- package/dist/dsh/on-demand-intake.js +30 -7
- package/dist/dsh/on-demand-intake.js.map +1 -1
- package/dist/dsh/repository-learning-reflector.d.ts +58 -0
- package/dist/dsh/repository-learning-reflector.d.ts.map +1 -0
- package/dist/dsh/repository-learning-reflector.js +230 -0
- package/dist/dsh/repository-learning-reflector.js.map +1 -0
- package/dist/dsh/repository-learning.d.ts +34 -0
- package/dist/dsh/repository-learning.d.ts.map +1 -0
- package/dist/dsh/repository-learning.js +512 -0
- package/dist/dsh/repository-learning.js.map +1 -0
- package/dist/dsh/task-completion.d.ts +7 -7
- package/dist/dsh/task-completion.d.ts.map +1 -1
- package/dist/dsh/task-completion.js +554 -194
- package/dist/dsh/task-completion.js.map +1 -1
- package/dist/dsh/task-state-host.d.ts +10 -10
- package/dist/dsh/task-state-host.d.ts.map +1 -1
- package/dist/dsh/task-state-host.js +337 -145
- package/dist/dsh/task-state-host.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/locale/en.json +1 -1
- package/dist/locale/ja.json +1 -1
- package/dist/locale/ko.json +1 -1
- package/dist/locale/zh-CN.json +1 -1
- package/dist/memory/forget.d.ts +2 -2
- package/dist/memory/forget.d.ts.map +1 -1
- package/dist/memory/forget.js +175 -74
- package/dist/memory/forget.js.map +1 -1
- package/dist/memory/replay-reflection.d.ts +94 -0
- package/dist/memory/replay-reflection.d.ts.map +1 -0
- package/dist/memory/replay-reflection.js +149 -0
- package/dist/memory/replay-reflection.js.map +1 -0
- package/dist/memory/replay-review.d.ts +18 -12
- package/dist/memory/replay-review.d.ts.map +1 -1
- package/dist/memory/replay-review.js +107 -46
- package/dist/memory/replay-review.js.map +1 -1
- package/dist/memory/repository-learning.d.ts +106 -0
- package/dist/memory/repository-learning.d.ts.map +1 -0
- package/dist/memory/repository-learning.js +348 -0
- package/dist/memory/repository-learning.js.map +1 -0
- package/docs/agenticreplay-recording.md +20 -2
- package/docs/on-demand-intake.md +8 -2
- package/docs/repository-learning.md +109 -0
- package/migrations/048_repository_learning.sql +65 -0
- package/package.json +6 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Continuous repository learning
|
|
2
|
+
|
|
3
|
+
Kiokuko automatically checks each **native conversation turn** (`turn/start` through
|
|
4
|
+
`turn/end`), not every token or intermediate model step. Task completion and a
|
|
5
|
+
post-task approval dialog are not prerequisites. Failed, cancelled, no-tool and
|
|
6
|
+
unknown turns are retained as those lifecycle observations, never as verified task
|
|
7
|
+
success.
|
|
8
|
+
|
|
9
|
+
## Normal startup and data flow
|
|
10
|
+
|
|
11
|
+
The public plugin's lifecycle memory mounts the repository-learning coordinator.
|
|
12
|
+
At a turn boundary it freezes bounded, redacted native user/tool/result/assistant
|
|
13
|
+
observations, the native session/turn identity and the current model route. It uses
|
|
14
|
+
the host's actual `llm.prepareCall` / `llm.stream` API on that route, with no tools,
|
|
15
|
+
to propose up to four source-cited hypotheses. An externally registered
|
|
16
|
+
`kiokukoReplayReflector` service is **not required** for this path.
|
|
17
|
+
|
|
18
|
+
The reflector receives the previous repository compact and this turn's evidence.
|
|
19
|
+
It can refine previous hypotheses in light of new evidence. SQLite appends the
|
|
20
|
+
turn and atomically updates a bounded projection: recent observations and compact
|
|
21
|
+
hypotheses, including provenance, uncertainty, repeated occurrence counts and
|
|
22
|
+
repository tags. A correction may name existing hypothesis IDs in `supersedes`, supply a
|
|
23
|
+
`correctionReason`, and cite current-turn evidence. Validated replacements retire
|
|
24
|
+
only those named proposals from active context, while the ledger retains their
|
|
25
|
+
history and the replacement retains lineage. Replacements remain unverified
|
|
26
|
+
model-proposed corrections, not established truth. Distinct remaining hypotheses
|
|
27
|
+
retain an unresolved-compatibility assessment. History remains in SQLite while the
|
|
28
|
+
model-visible projection has a whole-point budget; omitted points are counted.
|
|
29
|
+
|
|
30
|
+
Before subsequent model steps, the coordinator waits for preceding repository
|
|
31
|
+
learning and reads that repository's projection directly. **Keyword overlap is not
|
|
32
|
+
required**. A new session in the same canonical repository gets the accumulated
|
|
33
|
+
compact; another repository does not. Root identity comes from trusted host cwd
|
|
34
|
+
and repository resolution, not model-supplied tags. The injected section is
|
|
35
|
+
`memory:repository-learning`, not an "approved" memory. It explicitly labels its
|
|
36
|
+
contents as fallible reference data, never instructions, permissions or verified
|
|
37
|
+
success. Prior persisted projections are retired so obsolete notes do not remain
|
|
38
|
+
on the active prompt surface.
|
|
39
|
+
|
|
40
|
+
## Durability and diagnostics
|
|
41
|
+
|
|
42
|
+
Migration `048_repository_learning.sql` adds the append-only turn ledger and
|
|
43
|
+
bounded repository projection. Idempotent session/turn identities prevent duplicate
|
|
44
|
+
records. Updates use an immediate SQLite transaction and capture-policy revision
|
|
45
|
+
checks. At plugin reload the latest native turn is reconstructed from up to 512
|
|
46
|
+
session events (excluding inherited fork history); already saved turns are not
|
|
47
|
+
reflected again. Earlier unsaved turns beyond this bounded recovery window are not
|
|
48
|
+
claimed recovered.
|
|
49
|
+
|
|
50
|
+
Ignorable session plugin records named `plugin:kiokuko-dsh/repository-learning`
|
|
51
|
+
(and live host events `kiokuko/repository-learning`) report capture and retrieval:
|
|
52
|
+
|
|
53
|
+
- capture: saved, duplicate, excluded or unavailable; revision and reflection status;
|
|
54
|
+
- retrieval: injected, empty or unavailable; injected and omitted point counts.
|
|
55
|
+
|
|
56
|
+
A missing model route, malformed/ungrounded result or 15-second model deadline
|
|
57
|
+
produces an explicit unavailable/invalid reflection status. The observed turn can
|
|
58
|
+
still be saved without invented model lessons. Database/capture failures are
|
|
59
|
+
reported as unavailable, not silently described as successful saving. This feature
|
|
60
|
+
never launches DSH, changes repository source, runs learned commands or grants tool
|
|
61
|
+
permissions.
|
|
62
|
+
|
|
63
|
+
Existing "do not remember" capture refusals and exclusion revisions are respected
|
|
64
|
+
before dispatch and commit. Retraction conservatively purges all learning in the affected repository, including
|
|
65
|
+
later-session derivatives. Existing entry forget purges learning in its workspace.
|
|
66
|
+
A persistent admission epoch rejects previously admitted delayed results, including
|
|
67
|
+
results from another session. Unrelated stored repositories are preserved.
|
|
68
|
+
`/kioku-memory learning status` shows safe counts and revision;
|
|
69
|
+
`/kioku-memory learning reset` clears the current trusted repository only and
|
|
70
|
+
invalidates pending admissions. Payload-free turn identities prevent deleted turns
|
|
71
|
+
from being recovered and learned again after reload. Native conversation logs and provider transcripts
|
|
72
|
+
are not erased by these commands.
|
|
73
|
+
Known secrets are filtered/rejected. These safeguards and explicit untrusted-data
|
|
74
|
+
framing are not a claim of perfect semantic prompt-injection detection.
|
|
75
|
+
|
|
76
|
+
## What is and is not guaranteed
|
|
77
|
+
|
|
78
|
+
The implementation makes repository learning available in later model inputs when
|
|
79
|
+
storage and the host route are available, with observable failures. It does not
|
|
80
|
+
force a model to follow a lesson, prove that a lesson is correct, or claim measured
|
|
81
|
+
success-rate improvement. Native integration tests use the real DSH plugin/model
|
|
82
|
+
routing and controlled model responses; they are not live-provider effectiveness
|
|
83
|
+
measurements. Source application alone does not update an already running DSH
|
|
84
|
+
process.
|
|
85
|
+
|
|
86
|
+
## Interrupted saves and recovery
|
|
87
|
+
|
|
88
|
+
Reflection has a bounded deadline and no automatic network retry. A disconnected
|
|
89
|
+
or invalid model stream may still save the observed turn with an unavailable or
|
|
90
|
+
invalid reflection, without inventing a lesson. Foreground work can continue.
|
|
91
|
+
SQLite writes retry only recognized lock contention under the existing finite
|
|
92
|
+
backoff policy; no tool or external side effect is replayed by learning recovery.
|
|
93
|
+
|
|
94
|
+
| Boundary | Durable result and recovery |
|
|
95
|
+
| ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
96
|
+
| Before/during/after the model response | Save observations only if reflection fails; the next turn remains usable. |
|
|
97
|
+
| Failure inside the save transaction | Roll back turn and projection together. Capture diagnostics report `saveState: not_saved`; reload the plugin to retry the latest retained native turn, or use `/kioku-memory learning reset` to discard it. |
|
|
98
|
+
| Commit succeeded but acknowledgement was lost | Re-read the exact repository/session/turn. Report `saved` when found, `unknown` if storage cannot be read. Do not assume rollback or repeat tools. Reload reconciles the stored identity before any new reflection. |
|
|
99
|
+
| Process exits before/after commit | SQLite rollback or committed turn survives reopening. The exact identity prevents a second save. Recovery remains limited to the latest 512 retained native events. |
|
|
100
|
+
| Explicit native Stop or agent/workspace ownership loss | Discard unsaved in-flight reflection, retain only a payload-free retired identity, and reject its late result after reload. Already committed observations are not undone. |
|
|
101
|
+
| Plugin reload | Abort the old coordinator; reconstruct the latest retained turn. A saved turn is a duplicate, an unsaved turn can be retried. No raw reflection response is persisted for retry. |
|
|
102
|
+
| New instruction or next turn | Completed earlier turns append in order to the current projection; they do not replace a newer snapshot with an old snapshot. Stop can cancel outstanding reflection so the next instruction can proceed. |
|
|
103
|
+
| Reset/forget | Existing admission epochs and tombstones reject pre-reset results. Reset also clears current-repository pending admissions; new turns remain enabled. |
|
|
104
|
+
|
|
105
|
+
Capture diagnostics retain only safe identities/counts, `saveState`, and a
|
|
106
|
+
`reload_or_reset` recovery hint when a save is absent or uncertain. There is no
|
|
107
|
+
background retry queue or indefinite lease on a model request. A model timeout,
|
|
108
|
+
unknown save outcome or exhausted SQLite retry is not claimed automatically
|
|
109
|
+
recovered. Reset does not erase native logs or user data.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
-- Host-bound per-turn observations and bounded repository-local learning projection.
|
|
2
|
+
-- Completion is a lifecycle observation, not a verification claim.
|
|
3
|
+
CREATE TABLE repository_learning_turns (
|
|
4
|
+
repository_key TEXT NOT NULL,
|
|
5
|
+
workspace TEXT NOT NULL,
|
|
6
|
+
policy_revision INTEGER NOT NULL,
|
|
7
|
+
session_id TEXT NOT NULL,
|
|
8
|
+
turn_id TEXT NOT NULL,
|
|
9
|
+
terminal_seq INTEGER NOT NULL,
|
|
10
|
+
content_hash TEXT NOT NULL,
|
|
11
|
+
revision INTEGER NOT NULL,
|
|
12
|
+
turn_json TEXT NOT NULL,
|
|
13
|
+
PRIMARY KEY (repository_key, session_id, turn_id),
|
|
14
|
+
UNIQUE (repository_key, revision)
|
|
15
|
+
);
|
|
16
|
+
CREATE TABLE repository_learning_state (
|
|
17
|
+
repository_key TEXT PRIMARY KEY,
|
|
18
|
+
revision INTEGER NOT NULL,
|
|
19
|
+
snapshot_json TEXT NOT NULL
|
|
20
|
+
);
|
|
21
|
+
-- Payload-free identities prevent native recovery from recreating erased turns.
|
|
22
|
+
CREATE TABLE repository_learning_retired_turns (
|
|
23
|
+
repository_key TEXT NOT NULL,
|
|
24
|
+
session_id TEXT NOT NULL,
|
|
25
|
+
turn_id TEXT NOT NULL,
|
|
26
|
+
PRIMARY KEY (repository_key, session_id, turn_id)
|
|
27
|
+
);
|
|
28
|
+
CREATE TABLE repository_learning_pending_admissions (
|
|
29
|
+
repository_key TEXT NOT NULL,
|
|
30
|
+
session_id TEXT NOT NULL,
|
|
31
|
+
turn_id TEXT NOT NULL,
|
|
32
|
+
epoch INTEGER NOT NULL,
|
|
33
|
+
PRIMARY KEY (repository_key,session_id,turn_id)
|
|
34
|
+
);
|
|
35
|
+
-- A global admission epoch conservatively cancels stale in-flight derivations,
|
|
36
|
+
-- including jobs that have not yet saved their first row.
|
|
37
|
+
CREATE TABLE repository_learning_admission (id INTEGER PRIMARY KEY CHECK(id=1), epoch INTEGER NOT NULL);
|
|
38
|
+
INSERT INTO repository_learning_admission VALUES(1,0);
|
|
39
|
+
-- Without precise cross-session dependency manifests, invalidate the whole repo.
|
|
40
|
+
CREATE TRIGGER repository_learning_exclude_insert AFTER INSERT ON memory_capture_exclusions
|
|
41
|
+
BEGIN
|
|
42
|
+
UPDATE repository_learning_admission SET epoch=epoch+1 WHERE id=1;
|
|
43
|
+
UPDATE repository_learning_state SET snapshot_json=json_set(snapshot_json,
|
|
44
|
+
'$.points',json('[]'),'$.tags',json_array(repository_key),
|
|
45
|
+
'$.turnCount',0,'$.omitted',0,'$.outcomeCounts',json('{"completed":0,"failed":0,"cancelled":0,"unknown":0}'))
|
|
46
|
+
WHERE repository_key IN (SELECT repository_key FROM repository_learning_turns WHERE workspace=NEW.workspace AND session_id=NEW.native_session_id);
|
|
47
|
+
INSERT OR IGNORE INTO repository_learning_retired_turns
|
|
48
|
+
SELECT repository_key,session_id,turn_id FROM repository_learning_turns WHERE repository_key IN
|
|
49
|
+
(SELECT repository_key FROM repository_learning_turns WHERE workspace=NEW.workspace AND session_id=NEW.native_session_id);
|
|
50
|
+
DELETE FROM repository_learning_turns WHERE repository_key IN
|
|
51
|
+
(SELECT repository_key FROM repository_learning_turns WHERE workspace=NEW.workspace AND session_id=NEW.native_session_id);
|
|
52
|
+
END;
|
|
53
|
+
CREATE TRIGGER repository_learning_exclude_update AFTER UPDATE ON memory_capture_exclusions
|
|
54
|
+
BEGIN
|
|
55
|
+
UPDATE repository_learning_admission SET epoch=epoch+1 WHERE id=1;
|
|
56
|
+
UPDATE repository_learning_state SET snapshot_json=json_set(snapshot_json,
|
|
57
|
+
'$.points',json('[]'),'$.tags',json_array(repository_key),
|
|
58
|
+
'$.turnCount',0,'$.omitted',0,'$.outcomeCounts',json('{"completed":0,"failed":0,"cancelled":0,"unknown":0}'))
|
|
59
|
+
WHERE repository_key IN (SELECT repository_key FROM repository_learning_turns WHERE workspace=NEW.workspace AND session_id=NEW.native_session_id);
|
|
60
|
+
INSERT OR IGNORE INTO repository_learning_retired_turns
|
|
61
|
+
SELECT repository_key,session_id,turn_id FROM repository_learning_turns WHERE repository_key IN
|
|
62
|
+
(SELECT repository_key FROM repository_learning_turns WHERE workspace=NEW.workspace AND session_id=NEW.native_session_id);
|
|
63
|
+
DELETE FROM repository_learning_turns WHERE repository_key IN
|
|
64
|
+
(SELECT repository_key FROM repository_learning_turns WHERE workspace=NEW.workspace AND session_id=NEW.native_session_id);
|
|
65
|
+
END;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kiokuko-dsh",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.28",
|
|
4
4
|
"description": "Kiokuko plugin for DeepSeek Harness",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -195,6 +195,7 @@
|
|
|
195
195
|
"test:sampledb": "npm run build && node --import tsx tests/ci/verify-sample-database.ts",
|
|
196
196
|
"publint": "publint",
|
|
197
197
|
"pack:check": "node scripts/pack-check.mjs",
|
|
198
|
+
"prepublishOnly": "npm ci --include=dev --include=optional --ignore-scripts",
|
|
198
199
|
"prepare": "npm run build",
|
|
199
200
|
"test:agenticreplay:package": "npm run build && node scripts/verify-agenticreplay-consumer.mjs && node scripts/verify-agenticreplay-consumer.mjs --pnpm",
|
|
200
201
|
"test:memory-review": "node scripts/run-tests.mjs tests/dsh/unit/memory-review tests/dsh/integration/memory-review",
|
|
@@ -286,6 +287,7 @@
|
|
|
286
287
|
"@ai-sdk/provider": "^4.0.21",
|
|
287
288
|
"@deepseek-ai/cordis": "*",
|
|
288
289
|
"@deepseek-ai/dsh-agent": "*",
|
|
290
|
+
"@deepseek-ai/dsh-session": "*",
|
|
289
291
|
"@deepseek-ai/dsh-attachment": "*",
|
|
290
292
|
"@deepseek-ai/dsh-llm": "*",
|
|
291
293
|
"@deepseek-ai/dsh-llm-pi-ai": "*",
|
|
@@ -295,6 +297,9 @@
|
|
|
295
297
|
"@deepseek-ai/dsh-tools": "*"
|
|
296
298
|
},
|
|
297
299
|
"peerDependenciesMeta": {
|
|
300
|
+
"@deepseek-ai/dsh-session": {
|
|
301
|
+
"optional": true
|
|
302
|
+
},
|
|
298
303
|
"@huggingface/hub": {
|
|
299
304
|
"optional": true
|
|
300
305
|
},
|