kiokuko-dsh 0.2.20 → 0.2.22

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.
Files changed (159) hide show
  1. package/README.ja.md +1 -1
  2. package/README.ko.md +86 -2
  3. package/README.zh-CN.md +86 -2
  4. package/dist/dsh/clarification-context.d.ts +24 -0
  5. package/dist/dsh/clarification-context.d.ts.map +1 -0
  6. package/dist/dsh/clarification-context.js +31 -0
  7. package/dist/dsh/clarification-context.js.map +1 -0
  8. package/dist/dsh/coding-question.d.ts +26 -0
  9. package/dist/dsh/coding-question.d.ts.map +1 -0
  10. package/dist/dsh/coding-question.js +48 -0
  11. package/dist/dsh/coding-question.js.map +1 -0
  12. package/dist/dsh/coding-workflow/contracts.d.ts +2 -2
  13. package/dist/dsh/coding-workflow/host.d.ts +2 -4
  14. package/dist/dsh/coding-workflow/host.d.ts.map +1 -1
  15. package/dist/dsh/coding-workflow/host.js +13 -29
  16. package/dist/dsh/coding-workflow/host.js.map +1 -1
  17. package/dist/dsh/coding-workflow/intent.d.ts.map +1 -1
  18. package/dist/dsh/coding-workflow/intent.js +2 -1
  19. package/dist/dsh/coding-workflow/intent.js.map +1 -1
  20. package/dist/dsh/coding-workflow/service.d.ts +6 -6
  21. package/dist/dsh/coding-workflow/service.d.ts.map +1 -1
  22. package/dist/dsh/coding-workflow/service.js +5 -3
  23. package/dist/dsh/coding-workflow/service.js.map +1 -1
  24. package/dist/dsh/config.d.ts +6 -0
  25. package/dist/dsh/config.d.ts.map +1 -1
  26. package/dist/dsh/core/host.d.ts +6 -0
  27. package/dist/dsh/core/host.d.ts.map +1 -1
  28. package/dist/dsh/core/index.d.ts +18 -0
  29. package/dist/dsh/core/index.d.ts.map +1 -1
  30. package/dist/dsh/decisions/config.d.ts +6 -0
  31. package/dist/dsh/decisions/config.d.ts.map +1 -1
  32. package/dist/dsh/decisions/config.js +1 -0
  33. package/dist/dsh/decisions/config.js.map +1 -1
  34. package/dist/dsh/decisions/contracts.d.ts +4 -3
  35. package/dist/dsh/decisions/contracts.d.ts.map +1 -1
  36. package/dist/dsh/decisions/contracts.js +1 -1
  37. package/dist/dsh/decisions/contracts.js.map +1 -1
  38. package/dist/dsh/decisions/curator.d.ts +5 -0
  39. package/dist/dsh/decisions/curator.d.ts.map +1 -0
  40. package/dist/dsh/decisions/curator.js +17 -0
  41. package/dist/dsh/decisions/curator.js.map +1 -0
  42. package/dist/dsh/decisions/diagnostics.d.ts +11 -10
  43. package/dist/dsh/decisions/diagnostics.d.ts.map +1 -1
  44. package/dist/dsh/decisions/diagnostics.js +1 -1
  45. package/dist/dsh/decisions/diagnostics.js.map +1 -1
  46. package/dist/dsh/decisions/service.d.ts +1 -0
  47. package/dist/dsh/decisions/service.d.ts.map +1 -1
  48. package/dist/dsh/decisions/service.js +2 -1
  49. package/dist/dsh/decisions/service.js.map +1 -1
  50. package/dist/dsh/guardrail/contracts.d.ts +33 -1
  51. package/dist/dsh/guardrail/contracts.d.ts.map +1 -1
  52. package/dist/dsh/guardrail/contracts.js +1 -1
  53. package/dist/dsh/guardrail/contracts.js.map +1 -1
  54. package/dist/dsh/guardrail/engine.d.ts +2 -0
  55. package/dist/dsh/guardrail/engine.d.ts.map +1 -1
  56. package/dist/dsh/guardrail/engine.js +18 -7
  57. package/dist/dsh/guardrail/engine.js.map +1 -1
  58. package/dist/dsh/guardrail/evidence.d.ts.map +1 -1
  59. package/dist/dsh/guardrail/evidence.js +29 -1
  60. package/dist/dsh/guardrail/evidence.js.map +1 -1
  61. package/dist/dsh/guardrail/service.d.ts +2 -0
  62. package/dist/dsh/guardrail/service.d.ts.map +1 -1
  63. package/dist/dsh/guardrail/service.js +44 -2
  64. package/dist/dsh/guardrail/service.js.map +1 -1
  65. package/dist/dsh/host-adapter/tool-host.d.ts.map +1 -1
  66. package/dist/dsh/host-adapter/tool-host.js +5 -2
  67. package/dist/dsh/host-adapter/tool-host.js.map +1 -1
  68. package/dist/dsh/index.d.ts +6 -0
  69. package/dist/dsh/index.d.ts.map +1 -1
  70. package/dist/dsh/lisp/ci.d.ts +7 -0
  71. package/dist/dsh/lisp/ci.d.ts.map +1 -1
  72. package/dist/dsh/lisp/ci.js +27 -10
  73. package/dist/dsh/lisp/ci.js.map +1 -1
  74. package/dist/dsh/lisp/coding-choice.d.ts +2 -0
  75. package/dist/dsh/lisp/coding-choice.d.ts.map +1 -1
  76. package/dist/dsh/lisp/coding-choice.js +5 -1
  77. package/dist/dsh/lisp/coding-choice.js.map +1 -1
  78. package/dist/dsh/lisp/coding-preparation.d.ts +4 -5
  79. package/dist/dsh/lisp/coding-preparation.d.ts.map +1 -1
  80. package/dist/dsh/lisp/coding-preparation.js +57 -18
  81. package/dist/dsh/lisp/coding-preparation.js.map +1 -1
  82. package/dist/dsh/lisp/manager.d.ts +3 -0
  83. package/dist/dsh/lisp/manager.d.ts.map +1 -1
  84. package/dist/dsh/lisp/manager.js +114 -13
  85. package/dist/dsh/lisp/manager.js.map +1 -1
  86. package/dist/dsh/lisp/surface.d.ts.map +1 -1
  87. package/dist/dsh/lisp/surface.js +36 -18
  88. package/dist/dsh/lisp/surface.js.map +1 -1
  89. package/dist/dsh/lisp/worker.d.ts +10 -2
  90. package/dist/dsh/lisp/worker.d.ts.map +1 -1
  91. package/dist/dsh/lisp/worker.js +21 -11
  92. package/dist/dsh/lisp/worker.js.map +1 -1
  93. package/dist/dsh/managed-operation-journal.d.ts +115 -0
  94. package/dist/dsh/managed-operation-journal.d.ts.map +1 -0
  95. package/dist/dsh/managed-operation-journal.js +336 -0
  96. package/dist/dsh/managed-operation-journal.js.map +1 -0
  97. package/dist/dsh/managed-operation-runner.d.ts +33 -0
  98. package/dist/dsh/managed-operation-runner.d.ts.map +1 -0
  99. package/dist/dsh/managed-operation-runner.js +104 -0
  100. package/dist/dsh/managed-operation-runner.js.map +1 -0
  101. package/dist/dsh/models/vendor/opencode-adapter.d.ts.map +1 -1
  102. package/dist/dsh/models/vendor/opencode-adapter.js +2 -0
  103. package/dist/dsh/models/vendor/opencode-adapter.js.map +1 -1
  104. package/dist/dsh/on-demand-intake.d.ts +5 -0
  105. package/dist/dsh/on-demand-intake.d.ts.map +1 -1
  106. package/dist/dsh/on-demand-intake.js +30 -8
  107. package/dist/dsh/on-demand-intake.js.map +1 -1
  108. package/dist/dsh/owned-execution.d.ts +2 -0
  109. package/dist/dsh/owned-execution.d.ts.map +1 -1
  110. package/dist/dsh/owned-execution.js +242 -110
  111. package/dist/dsh/owned-execution.js.map +1 -1
  112. package/dist/dsh/request-interpretation-guidance.d.ts +26 -0
  113. package/dist/dsh/request-interpretation-guidance.d.ts.map +1 -0
  114. package/dist/dsh/request-interpretation-guidance.js +35 -0
  115. package/dist/dsh/request-interpretation-guidance.js.map +1 -0
  116. package/dist/dsh/task-completion-guidance.d.ts +25 -0
  117. package/dist/dsh/task-completion-guidance.d.ts.map +1 -0
  118. package/dist/dsh/task-completion-guidance.js +36 -0
  119. package/dist/dsh/task-completion-guidance.js.map +1 -0
  120. package/dist/dsh/task-completion-host.d.ts.map +1 -1
  121. package/dist/dsh/task-completion-host.js +17 -7
  122. package/dist/dsh/task-completion-host.js.map +1 -1
  123. package/dist/dsh/task-completion.d.ts +26 -2
  124. package/dist/dsh/task-completion.d.ts.map +1 -1
  125. package/dist/dsh/task-completion.js +27 -13
  126. package/dist/dsh/task-completion.js.map +1 -1
  127. package/dist/enno-oduno/coding-workflow.d.ts +1 -1
  128. package/dist/locale/en.json +1 -1
  129. package/dist/locale/ja.json +1 -1
  130. package/dist/locale/ko.json +1 -1
  131. package/dist/locale/zh-CN.json +1 -1
  132. package/dist/memory/correction-contract.d.ts +12 -12
  133. package/dist/memory/curator-classification.d.ts +52 -0
  134. package/dist/memory/curator-classification.d.ts.map +1 -0
  135. package/dist/memory/curator-classification.js +103 -0
  136. package/dist/memory/curator-classification.js.map +1 -0
  137. package/dist/memory/curator.d.ts +16 -2
  138. package/dist/memory/curator.d.ts.map +1 -1
  139. package/dist/memory/curator.js +72 -47
  140. package/dist/memory/curator.js.map +1 -1
  141. package/docs/curator-classification.md +76 -0
  142. package/docs/dependency-security.md +26 -0
  143. package/docs/guardrail.md +11 -4
  144. package/docs/lisp-prototype-planning.md +1 -1
  145. package/docs/lisp.md +1 -1
  146. package/docs/managed-operation-journal.md +21 -0
  147. package/guardrail/aarch64-apple-darwin/kiokuko-guardrail +0 -0
  148. package/guardrail/aarch64-apple-darwin/manifest.json +14 -18
  149. package/guardrail/aarch64-unknown-linux-musl/kiokuko-guardrail +0 -0
  150. package/guardrail/aarch64-unknown-linux-musl/manifest.json +14 -16
  151. package/guardrail/build-records.json +198 -0
  152. package/guardrail/manifest.json +25 -137
  153. package/guardrail/x86_64-unknown-linux-musl/kiokuko-guardrail +0 -0
  154. package/guardrail/x86_64-unknown-linux-musl/manifest.json +14 -15
  155. package/migrations/046_curator_classification.sql +12 -0
  156. package/migrations/047_managed_operation_journal.sql +21 -0
  157. package/package.json +2 -2
  158. package/scripts/guardrail-artifacts.d.mts +3 -0
  159. package/scripts/guardrail-artifacts.mjs +34 -2
@@ -0,0 +1,12 @@
1
+ -- Host-owned, content-bound assessments; no source text or authority labels.
2
+ CREATE TABLE curator_classifications (
3
+ workspace TEXT NOT NULL,
4
+ entry_id TEXT NOT NULL REFERENCES entries(id) ON DELETE CASCADE,
5
+ entry_revision INTEGER NOT NULL CHECK(entry_revision > 0),
6
+ input_digest TEXT NOT NULL,
7
+ policy_version TEXT NOT NULL,
8
+ configuration_digest TEXT NOT NULL,
9
+ result_json TEXT NOT NULL,
10
+ result_digest TEXT NOT NULL,
11
+ PRIMARY KEY(workspace,entry_id,entry_revision,input_digest,policy_version,configuration_digest)
12
+ );
@@ -0,0 +1,21 @@
1
+ -- Separate from owned execution: covers only plugin-observed managed boundaries.
2
+ CREATE TABLE dsh_managed_journal_keys (id INTEGER PRIMARY KEY CHECK(id=1), secret TEXT NOT NULL);
3
+ CREATE TABLE dsh_managed_scopes (
4
+ scope_id TEXT PRIMARY KEY, scope_json TEXT NOT NULL, sealed INTEGER NOT NULL DEFAULT 0,
5
+ collector_complete INTEGER NOT NULL DEFAULT 1, created_at INTEGER NOT NULL
6
+ );
7
+ CREATE TABLE dsh_managed_operations (
8
+ operation_id TEXT PRIMARY KEY, scope_id TEXT NOT NULL REFERENCES dsh_managed_scopes(scope_id),
9
+ sequence INTEGER NOT NULL, state TEXT NOT NULL, operation_json TEXT NOT NULL,
10
+ UNIQUE(scope_id,sequence)
11
+ );
12
+ CREATE TABLE dsh_managed_transitions (
13
+ operation_id TEXT NOT NULL REFERENCES dsh_managed_operations(operation_id),
14
+ sequence INTEGER NOT NULL, transition_json TEXT NOT NULL, PRIMARY KEY(operation_id,sequence)
15
+ );
16
+ CREATE TABLE dsh_managed_snapshots (
17
+ snapshot_id TEXT PRIMARY KEY, scope_id TEXT NOT NULL REFERENCES dsh_managed_scopes(scope_id),
18
+ snapshot_json TEXT NOT NULL, created_at INTEGER NOT NULL, retained INTEGER NOT NULL DEFAULT 0
19
+ );
20
+ CREATE INDEX dsh_managed_operations_scope ON dsh_managed_operations(scope_id);
21
+ CREATE UNIQUE INDEX dsh_managed_operations_original ON dsh_managed_operations(json_extract(operation_json,'$.originalRef')) WHERE json_extract(operation_json,'$.originalRef') IS NOT NULL;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kiokuko-dsh",
3
- "version": "0.2.20",
3
+ "version": "0.2.22",
4
4
  "description": "Kiokuko plugin for DeepSeek Harness",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -346,7 +346,7 @@
346
346
  },
347
347
  "guardrail": {
348
348
  "manifest": "guardrail/manifest.json",
349
- "manifestSha256": "8da49d55f6bb7b8ccf2717f6680e439adda3d7347fb77de39f77566dd6a6d2b1",
349
+ "manifestSha256": "d001ddccda7a8c47abcb6ea2f5b67c1fd4452593e3750c3bd20ffa087a773297",
350
350
  "availability": "Bundled Linux x64/arm64 static musl and macOS Apple Silicon (ARM64). Intel Mac is unsupported. Only Linux x64 native smoke was recorded for the bundled release. Missing or invalid host artifact blocks protocol enrollment.",
351
351
  "verification": "npm run verify:guardrail validates bundled identities without executing cross-built binaries; npm run check:guardrail checks current host availability."
352
352
  }
@@ -11,3 +11,6 @@ export interface ResolvedGuardrail {
11
11
  }
12
12
  /** Verify bundled file identities and format synchronously; no execution or network fallback. */
13
13
  export function resolveGuardrail(root: string, options?: GuardrailResolveOptions): ResolvedGuardrail
14
+
15
+ /** Verify the frozen source and release provenance in a repository checkout. */
16
+ export function verifyGuardrailSource(root: string): string
@@ -1,4 +1,4 @@
1
- import { constants, closeSync, fstatSync, lstatSync, openSync, readFileSync, realpathSync } from 'node:fs'
1
+ import { constants, closeSync, fstatSync, lstatSync, openSync, readFileSync, readdirSync, existsSync, realpathSync } from 'node:fs'
2
2
  import { createHash } from 'node:crypto'
3
3
  import { dirname, join, resolve } from 'node:path'
4
4
  import { fileURLToPath } from 'node:url'
@@ -93,6 +93,7 @@ function indexAt(root) {
93
93
  if (digest(bytes) !== metadata.guardrail.manifestSha256) fail('package manifest digest integrity mismatch')
94
94
  const index = json(bytes, 'guardrail manifest')
95
95
  if (index.schema !== 1 || index.package !== 'kiokuko-guardrail' || typeof index.version !== 'string' || !/^[0-9]+\.[0-9]+\.[0-9]+(?:[-+][a-zA-Z0-9.-]+)?$/u.test(index.version) || !record(index.targets) || !record(index.protocol) || index.protocol.path !== 'guardrail/protocols/coding-routine.lisp') fail('guardrail manifest identity/schema mismatch')
96
+ if (!hex(index.sourceSha256) || !record(index.buildRecords) || index.buildRecords.path !== 'guardrail/build-records.json' || !hex(index.buildRecords.sha256)) fail('missing release source/build record identity')
96
97
  if (Object.keys(index.targets).length === 0) fail('guardrail manifest declares no bundled targets')
97
98
  if (!Array.isArray(index.unavailableTargets) || Object.keys(index.targets).some(target => !Object.values(targets).includes(target)) || index.unavailableTargets.some(target => !Object.values(targets).includes(target) || target in index.targets)) fail('guardrail manifest target declaration mismatch')
98
99
  return { index, manifestDigest: digest(bytes) }
@@ -111,15 +112,45 @@ export function resolveGuardrail(root, options = {}) {
111
112
  const releaseBytes = regularBytes(root, entry.manifest, 1024 * 1024)
112
113
  if (digest(releaseBytes) !== entry.manifestSha256) fail('target manifest digest integrity mismatch')
113
114
  const release = json(releaseBytes, 'target manifest')
114
- if (release.schema !== 1 || release.package !== index.package || release.target !== target || release.version !== index.version || release.build_inputs?.target !== target || !hex(release.source_sha256)) fail('release manifest identity mismatch')
115
+ if (release.schema !== 1 || release.package !== index.package || release.target !== target || release.version !== index.version || release.build_inputs?.target !== target || release.source_sha256 !== index.sourceSha256) fail('release manifest identity mismatch')
115
116
  const binary = regularBytes(root, entry.binary, 16 * 1024 * 1024, true)
116
117
  matches(binary, entry, 'engine'); matches(binary, release.artifacts?.['bin/kiokuko-guardrail'], 'release engine')
117
118
  executableHeader(binary, target)
119
+ const recordsBytes = regularBytes(root, index.buildRecords.path, 1024 * 1024)
120
+ matches(recordsBytes, index.buildRecords, 'build records')
121
+ const records = json(recordsBytes, 'build records'), build = records.targets?.[target]
122
+ if (records.schema !== 1 || records.sourceSha256 !== index.sourceSha256 || !record(build) || build.sourceSha256 !== index.sourceSha256 || build.target !== target || build.binarySha256 !== digest(binary) || build.packageSha256 !== entry.verification?.package_sha256 || build.independentBuildsEqual !== true || !Array.isArray(build.builds) || build.builds.length !== 2 || build.builds.some(run => !record(run) || run.exitCode !== 0 || run.binarySha256 !== digest(binary) || !hex(run.stdoutSha256) || !hex(run.stderrSha256)) || build.nativeSmoke !== entry.verification?.native_smoke || entry.verification?.source_sha256 !== index.sourceSha256 || !hex(build.builderSha256) || !hex(build.linkerSha256) || build.cargoSha256 !== release.build_inputs.cargo_sha256 || build.rustcSha256 !== release.build_inputs.rustc_sha256) fail('build record/source/output integrity mismatch')
118
123
  const protocol = regularBytes(root, index.protocol.path, 256 * 1024)
119
124
  matches(protocol, index.protocol, 'protocol'); matches(protocol, release.artifacts?.['protocols/coding-routine.lisp'], 'release protocol')
120
125
  return { binary: join(root, entry.binary), protocol: join(root, index.protocol.path), engineDigest: digest(binary), protocolFileDigest: digest(protocol), manifestDigest, version: index.version, target }
121
126
  }
122
127
 
128
+ /** Repository-only source check. Packaged consumers deliberately do not carry Rust source. */
129
+ export function verifyGuardrailSource(root) {
130
+ root = resolve(root)
131
+ const { index } = indexAt(root)
132
+ const crate = join(root, 'crates/guardrail')
133
+ if (!existsSync(crate)) fail('source verification requires the repository crate')
134
+ function walk(prefix = '') {
135
+ return readdirSync(join(crate, prefix), { withFileTypes: true }).flatMap(entry => {
136
+ const path = prefix ? `${prefix}/${entry.name}` : entry.name
137
+ if (entry.isSymbolicLink()) fail(`source symlink is forbidden: ${path}`)
138
+ return entry.isDirectory() ? walk(path) : [path]
139
+ }).sort()
140
+ }
141
+ const source = json(regularBytes(root, 'crates/guardrail-release/source-manifest.json', 1024 * 1024), 'source manifest')
142
+ const files = Object.fromEntries(walk().map(path => [path, digest(regularBytes(crate, path, 1024 * 1024))]))
143
+ if (JSON.stringify(files) !== JSON.stringify(source.files) || digest(JSON.stringify(files)) !== source.sourceSha256 || source.sourceSha256 !== index.sourceSha256) fail('current source identity mismatch')
144
+ const provenance = json(regularBytes(root, 'crates/guardrail-release/release-provenance.json', 1024 * 1024), 'release provenance')
145
+ if (provenance.source_sha256 !== source.sourceSha256 || provenance.build_records_sha256 !== index.buildRecords.sha256) fail('release provenance source/build record mismatch')
146
+ if (provenance.build_runner_sha256 !== digest(regularBytes(root, 'crates/guardrail-release/release.py', 1024 * 1024))) fail('build runner identity mismatch')
147
+ for (const [target, entry] of Object.entries(index.targets)) {
148
+ const releaseBytes = regularBytes(root, entry.manifest, 1024 * 1024), release = json(releaseBytes, 'target manifest')
149
+ if (JSON.stringify(release.sources) !== JSON.stringify(files) || release.source_sha256 !== source.sourceSha256 || provenance.package_manifests?.[target]?.sha256 !== digest(releaseBytes)) fail('target current source/provenance mismatch')
150
+ }
151
+ return source.sourceSha256
152
+ }
153
+
123
154
  if (process.argv[1] && realpathSync(process.argv[1]) === fileURLToPath(import.meta.url)) {
124
155
  try {
125
156
  const root = resolve(dirname(fileURLToPath(import.meta.url)), '..')
@@ -128,6 +159,7 @@ if (process.argv[1] && realpathSync(process.argv[1]) === fileURLToPath(import.me
128
159
  if (process.argv[2] === '--check-host') console.log(JSON.stringify(resolveGuardrail(root)))
129
160
  else {
130
161
  const { index } = indexAt(root)
162
+ if (existsSync(join(root, 'crates/guardrail'))) verifyGuardrailSource(root)
131
163
  for (const entry of Object.values(index.targets)) resolveGuardrail(root, { platform: entry.platform, arch: entry.arch })
132
164
  if (!quiet) console.log(JSON.stringify({ verifiedTargets: Object.keys(index.targets), unavailableTargets: index.unavailableTargets, nativeExecutionClaim: false, verification: Object.fromEntries(Object.entries(index.targets).map(([target, entry]) => [target, entry.verification])) }))
133
165
  }