kiokuko-dsh 0.2.44 → 0.2.46
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/PERMISSIONS.md +3 -3
- package/README.ja.md +10 -4
- package/README.ko.md +10 -3
- package/README.md +10 -4
- package/README.zh-CN.md +10 -3
- package/dist/build-info.json +7 -0
- package/dist/client.cjs +268 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/context/replay-model-memory.d.ts +5 -1
- package/dist/context/replay-model-memory.d.ts.map +1 -1
- package/dist/context/replay-model-memory.js +6 -3
- package/dist/context/replay-model-memory.js.map +1 -1
- package/dist/dsh/agenticreplay-hooks.js +1 -1
- package/dist/dsh/agenticreplay-hooks.js.map +1 -1
- package/dist/dsh/agenticreplay-recorder.d.ts +5 -2
- package/dist/dsh/agenticreplay-recorder.d.ts.map +1 -1
- package/dist/dsh/agenticreplay-recorder.js +19 -9
- package/dist/dsh/agenticreplay-recorder.js.map +1 -1
- package/dist/dsh/answer-context.d.ts.map +1 -1
- package/dist/dsh/answer-context.js +4 -1
- package/dist/dsh/answer-context.js.map +1 -1
- package/dist/dsh/core/host.d.ts.map +1 -1
- package/dist/dsh/core/host.js +4 -1
- package/dist/dsh/core/host.js.map +1 -1
- package/dist/dsh/core/tasks.js +1 -1
- package/dist/dsh/core/tasks.js.map +1 -1
- package/dist/dsh/decisions/akinator-answers.d.ts +3 -3
- package/dist/dsh/decisions/akinator-answers.d.ts.map +1 -1
- package/dist/dsh/decisions/akinator-answers.js +5 -5
- package/dist/dsh/decisions/akinator-answers.js.map +1 -1
- package/dist/dsh/decisions/diagnostics.js +2 -2
- package/dist/dsh/decisions/diagnostics.js.map +1 -1
- package/dist/dsh/decisions/request-intent.d.ts +3 -0
- package/dist/dsh/decisions/request-intent.d.ts.map +1 -1
- package/dist/dsh/decisions/request-intent.js +11 -2
- package/dist/dsh/decisions/request-intent.js.map +1 -1
- package/dist/dsh/existing-task-intake.js +1 -1
- package/dist/dsh/existing-task-intake.js.map +1 -1
- package/dist/dsh/failure-diagnostic.d.ts +3 -0
- package/dist/dsh/failure-diagnostic.d.ts.map +1 -0
- package/dist/dsh/failure-diagnostic.js +30 -0
- package/dist/dsh/failure-diagnostic.js.map +1 -0
- package/dist/dsh/harness/factory.d.ts.map +1 -1
- package/dist/dsh/harness/factory.js +4 -2
- package/dist/dsh/harness/factory.js.map +1 -1
- package/dist/dsh/host-adapter/admission.d.ts.map +1 -1
- package/dist/dsh/host-adapter/admission.js +17 -1
- package/dist/dsh/host-adapter/admission.js.map +1 -1
- package/dist/dsh/host-adapter/routing.d.ts +3 -2
- package/dist/dsh/host-adapter/routing.d.ts.map +1 -1
- package/dist/dsh/host-adapter/routing.js +20 -5
- package/dist/dsh/host-adapter/routing.js.map +1 -1
- package/dist/dsh/host-adapter/session-observation.d.ts.map +1 -1
- package/dist/dsh/host-adapter/session-observation.js +4 -1
- package/dist/dsh/host-adapter/session-observation.js.map +1 -1
- package/dist/dsh/host-adapter/turn-state.d.ts +1 -0
- package/dist/dsh/host-adapter/turn-state.d.ts.map +1 -1
- package/dist/dsh/host-adapter/turn-state.js.map +1 -1
- package/dist/dsh/host-adapter.d.ts.map +1 -1
- package/dist/dsh/host-adapter.js +5 -27
- package/dist/dsh/host-adapter.js.map +1 -1
- package/dist/dsh/index.d.ts.map +1 -1
- package/dist/dsh/index.js +3 -1
- package/dist/dsh/index.js.map +1 -1
- package/dist/dsh/intake-gate.js +1 -1
- package/dist/dsh/intake-gate.js.map +1 -1
- package/dist/dsh/lifecycle-memory.d.ts.map +1 -1
- package/dist/dsh/lifecycle-memory.js +7 -2
- package/dist/dsh/lifecycle-memory.js.map +1 -1
- package/dist/dsh/lisp/proposal-batch.d.ts +1 -1
- package/dist/dsh/lisp/proposal-batch.d.ts.map +1 -1
- package/dist/dsh/lisp/proposal-batch.js +5 -46
- package/dist/dsh/lisp/proposal-batch.js.map +1 -1
- package/dist/dsh/lisp/surface.d.ts.map +1 -1
- package/dist/dsh/lisp/surface.js +4 -5
- package/dist/dsh/lisp/surface.js.map +1 -1
- package/dist/dsh/lisp/worker.d.ts.map +1 -1
- package/dist/dsh/lisp/worker.js +29 -31
- package/dist/dsh/lisp/worker.js.map +1 -1
- package/dist/dsh/memory-sidebar.d.ts +63 -0
- package/dist/dsh/memory-sidebar.d.ts.map +1 -0
- package/dist/dsh/memory-sidebar.js +221 -0
- package/dist/dsh/memory-sidebar.js.map +1 -0
- package/dist/dsh/models/profiles.d.ts.map +1 -1
- package/dist/dsh/models/profiles.js +5 -0
- package/dist/dsh/models/profiles.js.map +1 -1
- package/dist/dsh/models/service.d.ts.map +1 -1
- package/dist/dsh/models/service.js +33 -5
- package/dist/dsh/models/service.js.map +1 -1
- package/dist/dsh/models/vendor/infron-listing.d.ts +2 -2
- package/dist/dsh/models/vendor/infron-listing.d.ts.map +1 -1
- package/dist/dsh/models/vendor/infron-listing.js +10 -4
- package/dist/dsh/models/vendor/infron-listing.js.map +1 -1
- package/dist/dsh/on-demand-intake.d.ts +2 -1
- package/dist/dsh/on-demand-intake.d.ts.map +1 -1
- package/dist/dsh/on-demand-intake.js +12 -9
- package/dist/dsh/on-demand-intake.js.map +1 -1
- package/dist/dsh/owned-execution.d.ts +0 -1
- package/dist/dsh/owned-execution.d.ts.map +1 -1
- package/dist/dsh/owned-execution.js +28 -49
- package/dist/dsh/owned-execution.js.map +1 -1
- package/dist/dsh/plugin-evidence.d.ts +9 -0
- package/dist/dsh/plugin-evidence.d.ts.map +1 -0
- package/dist/dsh/plugin-evidence.js +33 -0
- package/dist/dsh/plugin-evidence.js.map +1 -0
- package/dist/dsh/session-history-compatibility.d.ts.map +1 -1
- package/dist/dsh/session-history-compatibility.js +7 -4
- package/dist/dsh/session-history-compatibility.js.map +1 -1
- package/dist/dsh/setup.d.ts +1 -1
- package/dist/dsh/setup.d.ts.map +1 -1
- package/dist/dsh/setup.js +1 -1
- package/dist/dsh/skill-prompts.json +1 -1
- package/dist/dsh/task-completion-guidance.js +1 -1
- package/dist/dsh/task-completion-guidance.js.map +1 -1
- package/dist/dsh/task-completion-host.d.ts.map +1 -1
- package/dist/dsh/task-completion-host.js +49 -11
- package/dist/dsh/task-completion-host.js.map +1 -1
- package/dist/dsh/task-completion.d.ts +22 -0
- package/dist/dsh/task-completion.d.ts.map +1 -1
- package/dist/dsh/task-completion.js +54 -4
- package/dist/dsh/task-completion.js.map +1 -1
- package/dist/dsh/task-startup.js +1 -1
- package/dist/dsh/task-startup.js.map +1 -1
- package/dist/dsh/task-state-host.js +1 -1
- package/dist/dsh/task-state-host.js.map +1 -1
- package/dist/dsh/tool-exposure-diagnostics.d.ts +29 -0
- package/dist/dsh/tool-exposure-diagnostics.d.ts.map +1 -0
- package/dist/dsh/tool-exposure-diagnostics.js +33 -0
- package/dist/dsh/tool-exposure-diagnostics.js.map +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/docs/agenticreplay-log-investigation-2026-11-04.ja.md +234 -0
- package/docs/lisp.md +14 -17
- package/docs/memory-evidence.md +4 -0
- package/docs/owned-execution.md +4 -3
- package/docs/patches/dsh-latest-local-update.patch +42 -0
- package/lisp/supervisor.mjs +8 -19
- package/package.json +3 -3
- package/skills/kiokuko-lisp/SKILL.md +6 -6
- package/skills/kiokuko-soul/SKILL.md +4 -4
- package/lisp/repository-owner.d.mts +0 -1
- package/lisp/repository-owner.mjs +0 -58
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
--- a/packages/boot/plugin-manager/src/operations.ts
|
|
2
|
+
+++ b/packages/boot/plugin-manager/src/operations.ts
|
|
3
|
+
@@ -151,2 +151,12 @@
|
|
4
|
+
+/** Explicit latest for one installed local package means its registry release.
|
|
5
|
+
+ * Keep registry, Git, missing packages and all other pnpm forms unchanged.
|
|
6
|
+
+ */
|
|
7
|
+
+export function latestRegistryUpdate(args: readonly string[], dependencies: Readonly<Record<string, string>>): readonly string[] {
|
|
8
|
+
+ if (!['update', 'up', 'upgrade'].includes(args[0] ?? '') || args.length !== 3 || !args.includes('--latest')) return args
|
|
9
|
+
+ const name = args[1] === '--latest' ? args[2] : args[1]
|
|
10
|
+
+ if (!name || !/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/i.test(name) || !/^(?:file:|link:)/.test(dependencies[name] ?? '')) return args
|
|
11
|
+
+ return ['add', `${name}@latest`]
|
|
12
|
+
+}
|
|
13
|
+
+
|
|
14
|
+
/** Install commands that take the packages to install as positionals. */
|
|
15
|
+
const INSTALL_COMMANDS = new Set(['add', 'install', 'i'])
|
|
16
|
+
@@ -313,5 +323,6 @@
|
|
17
|
+
}
|
|
18
|
+
const before = readProfileManifest('dsh', dir)
|
|
19
|
+
const savedFiles = ['package.json', 'pnpm-lock.yaml'].map(name => ({ path: join(dir, name), text: optionalFile(join(dir, name)) }))
|
|
20
|
+
+ args = latestRegistryUpdate(args, before.dependencies ?? {})
|
|
21
|
+
const beforeDependencies = directDependencies(before)
|
|
22
|
+
const installedBefore = new Map(Object.keys(beforeDependencies).map(name => [name, optionalFile(join(dir, 'node_modules', name, 'package.json'))]))
|
|
23
|
+
--- /dev/null
|
|
24
|
+
+++ b/packages/boot/plugin-manager/tests/latest-local-update.spec.ts
|
|
25
|
+
@@ -0,0 +1,17 @@
|
|
26
|
+
+import { expect, it } from 'vitest'
|
|
27
|
+
+import { latestRegistryUpdate } from '../src/operations.ts'
|
|
28
|
+
+
|
|
29
|
+
+it('explicit latest replaces a local profile package with its registry release', () => {
|
|
30
|
+
+ for (const source of ['file:/tmp/kiokuko-dsh-old.tgz', 'link:../../../checkout']) {
|
|
31
|
+
+ expect(latestRegistryUpdate(['update', 'kiokuko-dsh', '--latest'], { 'kiokuko-dsh': source })).toEqual(['add', 'kiokuko-dsh@latest'])
|
|
32
|
+
+ }
|
|
33
|
+
+})
|
|
34
|
+
+it('preserves registry updates, missing packages and non-latest or Git-pinned intent', () => {
|
|
35
|
+
+ for (const source of [undefined, '^0.2.44', 'git+https://example.invalid/pkg#fixed']) {
|
|
36
|
+
+ const args = ['update', 'kiokuko-dsh', '--latest']
|
|
37
|
+
+ expect(latestRegistryUpdate(args, source ? { 'kiokuko-dsh': source } : {})).toBe(args)
|
|
38
|
+
+ }
|
|
39
|
+
+ for (const args of [['update', 'kiokuko-dsh'], ['update', '--latest'], ['update', 'kiokuko-dsh', '--latest', '--recursive']]) {
|
|
40
|
+
+ expect(latestRegistryUpdate(args, { 'kiokuko-dsh': 'file:old.tgz' })).toBe(args)
|
|
41
|
+
+ }
|
|
42
|
+
+})
|
package/lisp/supervisor.mjs
CHANGED
|
@@ -2,33 +2,24 @@
|
|
|
2
2
|
// pipe. It stays outside the worker sandbox so arbitrary Lisp cannot disable it.
|
|
3
3
|
import { spawn, execFileSync } from 'node:child_process'
|
|
4
4
|
import { openSync, closeSync, writeSync, readFileSync } from 'node:fs'
|
|
5
|
-
import { claimRepository } from './repository-owner.mjs'
|
|
6
5
|
import { processIdentity, sameProcess } from './process-identity.mjs'
|
|
7
6
|
const launch = JSON.parse(process.argv[2])
|
|
8
|
-
let repositoryLease
|
|
9
|
-
if (launch.repositoryRoot) {
|
|
10
|
-
try { repositoryLease = claimRepository(launch.repositoryRoot) }
|
|
11
|
-
catch(error) {
|
|
12
|
-
writeSync(4, JSON.stringify({ type: 'error', code: error.message === 'REPOSITORY_IN_USE' ? 'REPOSITORY_IN_USE' : 'REPOSITORY_LOCK_FAILED' })+'\n')
|
|
13
|
-
process.exit(73)
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
7
|
let child, closing = false, terminationSent = false
|
|
17
8
|
let namespace, terminal, finishTimer, ownershipError = false
|
|
18
|
-
//
|
|
19
|
-
// and monitor exit.
|
|
9
|
+
// Keep unconfirmed ownership visible to the host watchdog after stdin EOF
|
|
10
|
+
// and monitor exit.
|
|
20
11
|
const namespaceLifetime = launch.namespaceInfo ? setInterval(() => {}, 60000) : undefined
|
|
21
12
|
const unconfirmed = message => {
|
|
22
13
|
if (!ownershipError) console.error(`LISP_STOP_UNCONFIRMED: ${message}`)
|
|
23
14
|
ownershipError = true
|
|
24
15
|
}
|
|
25
|
-
const reportRuntime = pid => {
|
|
26
|
-
if (!
|
|
16
|
+
const reportRuntime = (pid, identity) => {
|
|
17
|
+
if (!launch.runtimeReport) return
|
|
27
18
|
try {
|
|
28
|
-
const
|
|
29
|
-
writeSync(4, JSON.stringify({ type: 'runtime', pid, identity })+'\n')
|
|
19
|
+
const birth = identity === undefined ? processIdentity(pid) ?? null : identity
|
|
20
|
+
writeSync(4, JSON.stringify({ type: 'runtime', pid, identity: birth })+'\n')
|
|
30
21
|
} catch {
|
|
31
|
-
try { writeSync(4, JSON.stringify({ type: 'error', code: '
|
|
22
|
+
try { writeSync(4, JSON.stringify({ type: 'error', code: 'RUNTIME_IDENTITY_FAILED' })+'\n') } finally { stop() }
|
|
32
23
|
}
|
|
33
24
|
}
|
|
34
25
|
const parentPid = pid => process.platform === 'linux'
|
|
@@ -50,7 +41,6 @@ const finish = () => {
|
|
|
50
41
|
}
|
|
51
42
|
clearTimeout(finishTimer)
|
|
52
43
|
clearInterval(namespaceLifetime)
|
|
53
|
-
repositoryLease?.close()
|
|
54
44
|
process.exit(terminal.signal ? 128 : terminal.code ?? 70)
|
|
55
45
|
}
|
|
56
46
|
const kill = () => {
|
|
@@ -120,8 +110,7 @@ if (launch.namespaceInfo) {
|
|
|
120
110
|
}
|
|
121
111
|
}
|
|
122
112
|
namespace = { pid, identity }
|
|
123
|
-
|
|
124
|
-
reportRuntime(pid)
|
|
113
|
+
reportRuntime(pid, identity ?? null)
|
|
125
114
|
if (closing) kill()
|
|
126
115
|
finish()
|
|
127
116
|
} catch { unconfirmed('invalid or unowned sandbox child report') }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kiokuko-dsh",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.46",
|
|
4
4
|
"description": "Kiokuko plugin for DeepSeek Harness",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
]
|
|
116
116
|
},
|
|
117
117
|
"permissions": {
|
|
118
|
-
"summary": "Kiokuko-owned local development execution, candidate memory and host receipts; normal user environment, PATH commands and child processes.
|
|
118
|
+
"summary": "Kiokuko-owned local development execution, candidate memory and host receipts; normal user environment, PATH commands and child processes. Changes within the working project directory, including deletion, replacement and project DB updates, need no extra user permission. Outside-project changes require concrete confirmation.",
|
|
119
119
|
"readPaths": [
|
|
120
120
|
"Configured Kiokuko SQLite database and embedding assets",
|
|
121
121
|
"Registered project roots and their repository metadata",
|
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
},
|
|
178
178
|
"scripts": {
|
|
179
179
|
"clean:dist": "node --input-type=module --eval \"import { rmSync } from 'node:fs'; rmSync('dist', { recursive: true, force: true });\"",
|
|
180
|
-
"build": "npm run clean:dist && tsc -p tsconfig.build.json && node scripts/build-model-transports.mjs && node scripts/compile-skill-prompts.mjs && node scripts/build-dsh-client.mjs && node scripts/build-history-codecs.mjs && node scripts/build-plugin-entry.mjs && node scripts/guardrail-artifacts.mjs --verify-bundled --quiet && node scripts/verify-micro-judge.mjs",
|
|
180
|
+
"build": "npm run clean:dist && tsc -p tsconfig.build.json && node scripts/build-model-transports.mjs && node scripts/compile-skill-prompts.mjs && node scripts/build-dsh-client.mjs && node scripts/build-history-codecs.mjs && node scripts/build-plugin-entry.mjs && node scripts/guardrail-artifacts.mjs --verify-bundled --quiet && node scripts/verify-micro-judge.mjs && node scripts/build-runtime-manifest.mjs",
|
|
181
181
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
182
182
|
"test": "node scripts/run-tests.mjs tests/dsh",
|
|
183
183
|
"test:harness": "node --import tsx scripts/run-harness-evaluation.mjs",
|
|
@@ -16,7 +16,7 @@ Coding: coding_workflow defines Goal/items/checks before the task Lisp choice. P
|
|
|
16
16
|
|
|
17
17
|
Persistent: coding choice or /kioku-lisp enable. /kioku-lisp enable-task optionally selects disposable scratch evaluations. lisp_define, lisp_call and lisp_observe need no task-mode switch or Working task. Compose functions by exact dependency refs; reuse only your own protected worker, otherwise compute in private protected scratch with no repository mount or host RPC. Schemas never prove arbitrary Lisp safe. A child inherits only capabilities visible in its native scope, not the parent's task lease, heap, or result refs. Shared publication and real effects retain their approval and authority checks. ON selects Lisp computation/orchestration; direct Bash/zsh/PowerShell is rejected, even reads. Run Git/gh/builds/tests through kioku.process:run / start-job. Read/search/Skill and owned file tools remain available. Failure requires recovery or explicit /kioku-lisp disable; no silent shell fallback. Never spoof host-bound session/agent/directory/generation.
|
|
18
18
|
|
|
19
|
-
Owned kioku_read/write/edit/remove/exec/result retain development receipts. Ordinary commands, investigation, builds/tests, edits and disposable artifacts need no routine confirmation.
|
|
19
|
+
Owned kioku_read/write/edit/remove/exec/result retain development receipts. Ordinary commands, investigation, builds/tests, edits and disposable artifacts need no routine confirmation. Declare destructiveTargets for known command effects. Arbitrary code effects are not exhaustively classified. Organize memory only after completion and permission; save only the exact approved content.
|
|
20
20
|
|
|
21
21
|
Foreground kioku.process:run retains native Bash sandbox/approval/Stop without a memory task/Goal. Protected coding requires prototype/result inspection. Admitted workflows, owned tools and async jobs keep task/protocol authority. Use kioku.tools:call-tool/broker receipts. All workers are OS-isolated; direct Lisp/FFI cannot access workspace files or inherited credentials. Generated passed fields prove no verification. Bind task_completion conditions/source paths before checks; collect async receipts with kioku_result. Cancellation/ownership remain authoritative. Plan permits read/search/status until human approval exits at the next boundary.
|
|
22
22
|
|
|
@@ -60,10 +60,10 @@ identity/size/digest and read-only copies; other absolute paths fail. Limits: 64
|
|
|
60
60
|
256 MiB/generation. `kioku.files:input`: read; `kioku.files:scratch`: write/unzip. Reimport
|
|
61
61
|
applied files for comparison; export only when authorized. `kioku.files:propose-write`:
|
|
62
62
|
relative paths, successful evaluation, durable recording.
|
|
63
|
-
|
|
63
|
+
Changes within the working project directory, including deletion, replacement and project DB updates, need no extra user permission. Outside-project changes require concrete confirmation. Protected compatibility mode retains frozen targets and its protected-path restrictions. Duplicate targets fail;
|
|
64
64
|
unchanged writes do nothing. Refusal/skip/UI failure/cancellation never authorizes.
|
|
65
65
|
Trust APPLIED/UNCHANGED/NOT_APPLIED/UNKNOWN receipts; partial failure stops later writes.
|
|
66
|
-
Never retry unknown effects. Use owned tools for
|
|
66
|
+
Never retry unknown effects. Use owned tools for working-project files and project DB updates; protected compatibility mode refuses its protected paths/databases/links and recursive deletion. Independent backups never auto-prune. RUNNING lasts until
|
|
67
67
|
receipts save; restart repairs finalization without reapplying effects.
|
|
68
68
|
|
|
69
69
|
## Programs, verification and packages
|
|
@@ -185,7 +185,7 @@ Native tool schemas remain authoritative for exact arguments.
|
|
|
185
185
|
captured bytes in private scratch and runs an approved host verifier. Observe
|
|
186
186
|
all required files, including `package.json`; missing dependencies/scripts
|
|
187
187
|
fail or return NOT_APPLIED. `testStatus:unknown` is not a passing test.
|
|
188
|
-
- `lisp_apply`: `{operationId, candidateRef, verificationRef?}` uses owned execution in development mode
|
|
188
|
+
- `lisp_apply`: `{operationId, candidateRef, verificationRef?}` uses owned execution in development mode without extra approval for local changes; it rechecks the read set and frozen targets, and accepts only a successful
|
|
189
189
|
verification receipt for the same candidate. Without one, it reports `not-run`.
|
|
190
190
|
- `lisp_compare`: `{operationId, leftRef, rightRef}` compares saved bases and
|
|
191
191
|
operation/content hashes without executing either candidate.
|
|
@@ -349,11 +349,11 @@ shortlist order for selection; source and test for diagnosis. Define `obj` first
|
|
|
349
349
|
<!-- kiokuko:documentation approval-help -->
|
|
350
350
|
## Development approval policy
|
|
351
351
|
|
|
352
|
-
Project edits, verification, helper compilation/registration and ordinary Kioku storage are authorized.
|
|
352
|
+
Project edits, verification, helper compilation/registration and ordinary Kioku storage are authorized. Changes within the working project directory, including deletion, replacement and project DB updates, need no extra user permission. Outside-project changes require concrete confirmation. Legacy lisp.approvalMode ask/auto does not add confirmation for local files. Old profile settings still load. Do not request conversational permission before a required host review. Refusal, cancellation, stale targets and uncertain outcomes remain authoritative; never replay effects.
|
|
353
353
|
|
|
354
354
|
<!-- /kiokuko:documentation -->
|
|
355
355
|
<!-- kiokuko:runtime approval-policy -->
|
|
356
|
-
Routine development and helper registration are authorized.
|
|
356
|
+
Routine development and helper registration are authorized. Lisp failure retains the selected shell route. Report execution, verification and saving separately; retry saving without replaying effects.
|
|
357
357
|
<!-- /kiokuko:runtime -->
|
|
358
358
|
|
|
359
359
|
|
|
@@ -8,16 +8,16 @@ description: Kiokuko's entry router for non-trivial DSH work. Read it before any
|
|
|
8
8
|
<!-- kiokuko:runtime contract -->
|
|
9
9
|
# SOUL router
|
|
10
10
|
|
|
11
|
-
Read first. Host owns intake
|
|
11
|
+
Read first. Host owns intake, identity, capabilities and routing; require ready/exhausted and permissive nextAction. Never invent a profile.
|
|
12
12
|
|
|
13
|
-
User instructions outrank Skills. Preserve identity
|
|
13
|
+
User instructions outrank Skills. Preserve identity, revisions, leases, Plan, cancellation and ownership. Optional enrichment never vetoes work. Clarify unclear intent or destructive effects; finish, verify and report blockers.
|
|
14
14
|
|
|
15
15
|
**本当に、それを全部計算・保存・検索する必要があるのか?**
|
|
16
16
|
Preserve results: eliminate needless computation/storage/search, narrow scope, then optimize. Justify exhaustive work. Never silently approximate/delete data or waive validation, recovery or audit. No extra approvals/artifacts.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Read relevant Skill indexes and risk-selected references; non-code needs no coding startup. Preserve roles, exclusions and recovery.
|
|
19
19
|
|
|
20
|
-
Use current model/memory/Skills and kioku_read/write/edit/remove/exec/result.
|
|
20
|
+
Use current model/memory/Skills and kioku_read/write/edit/remove/exec/result. Changes within the working project directory, including deletion, replacement and project DB updates, need no extra user permission. Outside-project changes require concrete confirmation. PATH/bash/zsh, Lisp and builds/tests remain authorized; native permissions and integrity checks still apply. Recover Lisp or explicitly change route. Pre-bind source/test/config checks; collect final background receipts. Receipts establish observations only; check recalled candidates against current sources. Report work, verification and memory saving separately. After completion, get permission to organize memory; show the exact proposal and save only its user-approved revision. Comments need new previews; decline saves nothing. Memory failure never blocks work. Reconcile uncertain approved saves with the original key; never replay work or invent save identities. Human implementation requests or Plan approval request exit at the next accepted boundary; plan-only answers stay in Plan.
|
|
21
21
|
|
|
22
22
|
Without Skills, use current evidence within host identity/authority/integrity; never substitute required Skills or auto-install/execute fetched ones. Claim no unread Skills or unrun checks. Check supported file types before diagnostics; manually check Markdown/unsupported documents for structure, requirements and whitespace. Unavailable diagnostics stay unverified. After each successful edit/write, re-read before the next mutation; reconcile stale content and never force overwrites. Never repeat unsupported diagnostics unchanged.
|
|
23
23
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function claimRepository(root: string): { recordRuntime(pid: number): string | null; close(): void }
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// The existing supervisor holds this OS-backed SQLite lock until its runtime exits.
|
|
2
|
-
// The user directory is independent of DSH's DB, session and worker TMPDIR.
|
|
3
|
-
import { DatabaseSync } from 'node:sqlite'
|
|
4
|
-
import { createHash } from 'node:crypto'
|
|
5
|
-
import { lstatSync, mkdirSync, realpathSync, readFileSync, writeFileSync, renameSync, unlinkSync } from 'node:fs'
|
|
6
|
-
import { randomUUID } from 'node:crypto'
|
|
7
|
-
import { processIdentity, sameProcess } from './process-identity.mjs'
|
|
8
|
-
import { tmpdir } from 'node:os'
|
|
9
|
-
import { join } from 'node:path'
|
|
10
|
-
|
|
11
|
-
export function claimRepository(root) {
|
|
12
|
-
const canonical = realpathSync(root)
|
|
13
|
-
const directory = join(process.platform === 'win32' ? tmpdir() : '/tmp', `kiokuko-lisp-owners-${process.getuid?.() ?? 'user'}`)
|
|
14
|
-
mkdirSync(directory, { recursive: true, mode: 0o700 })
|
|
15
|
-
const info = lstatSync(directory)
|
|
16
|
-
if (!info.isDirectory() || info.isSymbolicLink() || (process.getuid && info.uid !== process.getuid()) || (info.mode & 0o077))
|
|
17
|
-
throw new Error('REPOSITORY_LOCK_DIRECTORY')
|
|
18
|
-
const path = join(directory, `${createHash('sha256').update(canonical).digest('hex')}.sqlite3`)
|
|
19
|
-
try { const file=lstatSync(path);if (!file.isFile() || file.isSymbolicLink()) throw new Error('REPOSITORY_LOCK_FILE') }
|
|
20
|
-
catch(error) { if(error.code !== 'ENOENT') throw error }
|
|
21
|
-
const db = new DatabaseSync(path)
|
|
22
|
-
const metadata=path+'.owner.json',token=randomUUID()
|
|
23
|
-
try {
|
|
24
|
-
// Opening a new SQLite file briefly takes reader locks in *both* contenders.
|
|
25
|
-
// A zero busy timeout can make both exclusive acquisitions fail before
|
|
26
|
-
// either owns the repository. Allow those short initialization reads to
|
|
27
|
-
// drain; an existing owner's lifetime transaction still rejects in 250ms.
|
|
28
|
-
db.exec('PRAGMA busy_timeout=250; BEGIN EXCLUSIVE; CREATE TABLE IF NOT EXISTS repository_owner(root TEXT NOT NULL)')
|
|
29
|
-
try {
|
|
30
|
-
const owner=JSON.parse(readFileSync(metadata,'utf8'))
|
|
31
|
-
if(!Number.isSafeInteger(owner.pid)||owner.pid<1||owner.root!==canonical||typeof owner.token!=='string'
|
|
32
|
-
||owner.identity!==null&&!/^[a-f0-9]{64}$/.test(owner.identity))throw new Error('REPOSITORY_LOCK_METADATA')
|
|
33
|
-
// A supervisor killed before cleanup must not donate its still-live runtime.
|
|
34
|
-
if(sameProcess(owner.pid,owner.identity??undefined))throw new Error('REPOSITORY_IN_USE')
|
|
35
|
-
} catch(error) { if(error.code!=='ENOENT')throw error }
|
|
36
|
-
db.prepare('DELETE FROM repository_owner').run()
|
|
37
|
-
db.prepare('INSERT INTO repository_owner VALUES(?)').run(canonical)
|
|
38
|
-
let recorded=false
|
|
39
|
-
return {
|
|
40
|
-
recordRuntime(pid){
|
|
41
|
-
const temporary=metadata+'.'+token
|
|
42
|
-
const identity=processIdentity(pid)??null
|
|
43
|
-
writeFileSync(temporary,JSON.stringify({root:canonical,pid,identity,token})+'\n',{flag:'wx',mode:0o600})
|
|
44
|
-
renameSync(temporary,metadata);recorded=true
|
|
45
|
-
return identity
|
|
46
|
-
},
|
|
47
|
-
close(){
|
|
48
|
-
// Called only after runtime exit. A crash leaves evidence for the next owner.
|
|
49
|
-
if(recorded){const owner=JSON.parse(readFileSync(metadata,'utf8'));if(owner.token===token)unlinkSync(metadata)}
|
|
50
|
-
db.close()
|
|
51
|
-
},
|
|
52
|
-
} // Transaction stays uncommitted; the OS releases it when this supervisor dies.
|
|
53
|
-
} catch(error) {
|
|
54
|
-
db.close()
|
|
55
|
-
if(error.errcode === 5 || error.code === 'SQLITE_BUSY') throw new Error('REPOSITORY_IN_USE')
|
|
56
|
-
throw error
|
|
57
|
-
}
|
|
58
|
-
}
|