memoryking 0.1.0__py3-none-any.whl

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 (179) hide show
  1. memoryking/__init__.py +3 -0
  2. memoryking/__main__.py +1328 -0
  3. memoryking/adapters/__init__.py +1 -0
  4. memoryking/adapters/adapter_state.py +242 -0
  5. memoryking/adapters/anchor_schema.sql +7 -0
  6. memoryking/adapters/atlas.py +441 -0
  7. memoryking/adapters/browser_commands.py +125 -0
  8. memoryking/adapters/dashboard.py +510 -0
  9. memoryking/adapters/dense_search.py +86 -0
  10. memoryking/adapters/egress_policy.py +244 -0
  11. memoryking/adapters/egress_schema.sql +13 -0
  12. memoryking/adapters/embedding.schema.json +302 -0
  13. memoryking/adapters/embedding_store.py +469 -0
  14. memoryking/adapters/execution.py +369 -0
  15. memoryking/adapters/experience.py +423 -0
  16. memoryking/adapters/experience.schema.json +1508 -0
  17. memoryking/adapters/experience_records.py +239 -0
  18. memoryking/adapters/experience_schema.sql +23 -0
  19. memoryking/adapters/handoff.py +494 -0
  20. memoryking/adapters/handoff.schema.json +299 -0
  21. memoryking/adapters/handoff_schema.sql +17 -0
  22. memoryking/adapters/index_schema.sql +11 -0
  23. memoryking/adapters/inference.py +454 -0
  24. memoryking/adapters/inference.schema.json +541 -0
  25. memoryking/adapters/inspection.py +1128 -0
  26. memoryking/adapters/inspection.schema.json +568 -0
  27. memoryking/adapters/knowledge.schema.json +633 -0
  28. memoryking/adapters/knowledge_schema.sql +37 -0
  29. memoryking/adapters/knowledge_store.py +800 -0
  30. memoryking/adapters/legacy_snapshot.py +358 -0
  31. memoryking/adapters/legacy_tables.py +49 -0
  32. memoryking/adapters/local_contract.py +45 -0
  33. memoryking/adapters/local_embeddings.py +189 -0
  34. memoryking/adapters/local_files.py +242 -0
  35. memoryking/adapters/local_ipc.py +258 -0
  36. memoryking/adapters/local_schema.sql +44 -0
  37. memoryking/adapters/local_store.py +632 -0
  38. memoryking/adapters/local_wire.schema.json +7672 -0
  39. memoryking/adapters/models/minilm-l6-v2-onnx.json +57 -0
  40. memoryking/adapters/models/ms-marco-minilm-l6-v2-onnx.json +57 -0
  41. memoryking/adapters/optional_schema.sql +43 -0
  42. memoryking/adapters/plan_dashboard.py +51 -0
  43. memoryking/adapters/plans.py +253 -0
  44. memoryking/adapters/postgres_admin.py +300 -0
  45. memoryking/adapters/postgres_anchor_schema.sql +9 -0
  46. memoryking/adapters/postgres_counter.sql +14 -0
  47. memoryking/adapters/postgres_egress_schema.sql +15 -0
  48. memoryking/adapters/postgres_experience_schema.sql +39 -0
  49. memoryking/adapters/postgres_index_schema.sql +7 -0
  50. memoryking/adapters/postgres_optional_schema.sql +71 -0
  51. memoryking/adapters/postgres_pool.py +77 -0
  52. memoryking/adapters/postgres_recovery.py +525 -0
  53. memoryking/adapters/postgres_schema.sql +365 -0
  54. memoryking/adapters/postgres_sql.py +102 -0
  55. memoryking/adapters/postgres_store.py +428 -0
  56. memoryking/adapters/postgres_summary_schema.sql +12 -0
  57. memoryking/adapters/postgres_trust_schema.sql +20 -0
  58. memoryking/adapters/processing.schema.json +471 -0
  59. memoryking/adapters/processing_store.py +346 -0
  60. memoryking/adapters/projects.py +83 -0
  61. memoryking/adapters/proposals.py +238 -0
  62. memoryking/adapters/ranking.py +315 -0
  63. memoryking/adapters/repository.schema.json +664 -0
  64. memoryking/adapters/repository_git.py +264 -0
  65. memoryking/adapters/repository_schema.sql +25 -0
  66. memoryking/adapters/repository_store.py +960 -0
  67. memoryking/adapters/retrieval.py +1285 -0
  68. memoryking/adapters/retrieval.schema.json +553 -0
  69. memoryking/adapters/retrieval_schema.sql +10 -0
  70. memoryking/adapters/shared_control.py +40 -0
  71. memoryking/adapters/shared_dashboard.py +636 -0
  72. memoryking/adapters/shared_gateway.py +63 -0
  73. memoryking/adapters/shared_http.py +216 -0
  74. memoryking/adapters/shared_mcp.py +159 -0
  75. memoryking/adapters/shared_service.py +124 -0
  76. memoryking/adapters/stdio.py +193 -0
  77. memoryking/adapters/stdio.tools.json +6776 -0
  78. memoryking/adapters/summary_schema.sql +10 -0
  79. memoryking/adapters/team.py +253 -0
  80. memoryking/adapters/timeline.py +80 -0
  81. memoryking/adapters/token_count.py +55 -0
  82. memoryking/adapters/tokenizers/LICENSE +21 -0
  83. memoryking/adapters/tokenizers/cl100k_base.tiktoken +100256 -0
  84. memoryking/adapters/trust.py +123 -0
  85. memoryking/adapters/trust_schema.sql +13 -0
  86. memoryking/adapters/web/app.css +1251 -0
  87. memoryking/adapters/web/app.js +907 -0
  88. memoryking/adapters/web/brand.js +44 -0
  89. memoryking/adapters/web/crown-mono.svg +1 -0
  90. memoryking/adapters/web/crown.svg +8 -0
  91. memoryking/adapters/web/elephant.png +0 -0
  92. memoryking/adapters/web/favicon.svg +8 -0
  93. memoryking/adapters/web/graph-layout.js +52 -0
  94. memoryking/adapters/web/graph-worker.js +10 -0
  95. memoryking/adapters/web/graph.js +570 -0
  96. memoryking/adapters/web/index.html +208 -0
  97. memoryking/adapters/web/observatory.js +1208 -0
  98. memoryking/adapters/web/team.js +151 -0
  99. memoryking/adapters/web/wordmark.svg +1 -0
  100. memoryking/adapters/working.py +971 -0
  101. memoryking/adapters/working.schema.json +1717 -0
  102. memoryking/adapters/working_schema.sql +24 -0
  103. memoryking/application/__init__.py +1 -0
  104. memoryking/application/conformance.py +50 -0
  105. memoryking/application/legacy_import.py +337 -0
  106. memoryking/application/local_port.py +9 -0
  107. memoryking/application/storage.py +117 -0
  108. memoryking/application/store_core.py +1292 -0
  109. memoryking/backups.py +131 -0
  110. memoryking/contracts/__init__.py +6 -0
  111. memoryking/contracts/__main__.py +20 -0
  112. memoryking/contracts/canonical.py +88 -0
  113. memoryking/contracts/embedding.schema.json +302 -0
  114. memoryking/contracts/embedding_generated.py +65 -0
  115. memoryking/contracts/experience.schema.json +1508 -0
  116. memoryking/contracts/experience_generated.py +239 -0
  117. memoryking/contracts/generated.py +122 -0
  118. memoryking/contracts/handoff.schema.json +299 -0
  119. memoryking/contracts/handoff_generated.py +69 -0
  120. memoryking/contracts/inference.schema.json +541 -0
  121. memoryking/contracts/inference_generated.py +106 -0
  122. memoryking/contracts/processing.schema.json +471 -0
  123. memoryking/contracts/processing_generated.py +82 -0
  124. memoryking/contracts/py.typed +0 -0
  125. memoryking/contracts/repository.schema.json +664 -0
  126. memoryking/contracts/repository_generated.py +144 -0
  127. memoryking/contracts/retrieval.schema.json +553 -0
  128. memoryking/contracts/retrieval_generated.py +110 -0
  129. memoryking/contracts/schema.json +696 -0
  130. memoryking/contracts/validation.py +92 -0
  131. memoryking/contracts/working.schema.json +1717 -0
  132. memoryking/contracts/working_generated.py +291 -0
  133. memoryking/domain/__init__.py +1 -0
  134. memoryking/domain/anchors.py +97 -0
  135. memoryking/domain/briefing.py +108 -0
  136. memoryking/domain/briefing_text.py +222 -0
  137. memoryking/domain/checkpoint.py +118 -0
  138. memoryking/domain/compression.py +64 -0
  139. memoryking/domain/delta.py +129 -0
  140. memoryking/domain/embeddings.py +90 -0
  141. memoryking/domain/hints.py +465 -0
  142. memoryking/domain/http_status.py +45 -0
  143. memoryking/domain/learning.py +62 -0
  144. memoryking/domain/local.py +65 -0
  145. memoryking/domain/plans.py +140 -0
  146. memoryking/domain/repository.py +118 -0
  147. memoryking/domain/selectors.py +356 -0
  148. memoryking/domain/summary.py +88 -0
  149. memoryking/domain/usage.py +163 -0
  150. memoryking/embedding_loop.py +98 -0
  151. memoryking/embedding_worker.py +131 -0
  152. memoryking/harness.py +882 -0
  153. memoryking/harness_context.py +376 -0
  154. memoryking/hooks.py +171 -0
  155. memoryking/host_hooks.py +454 -0
  156. memoryking/lean.py +352 -0
  157. memoryking/memory_tool.py +776 -0
  158. memoryking/migration.py +194 -0
  159. memoryking/model_install.py +78 -0
  160. memoryking/observability.py +101 -0
  161. memoryking/observability_metrics.py +100 -0
  162. memoryking/profiles.py +150 -0
  163. memoryking/providers.py +330 -0
  164. memoryking/py.typed +0 -0
  165. memoryking/pytest_plugin.py +69 -0
  166. memoryking/reference_agent.py +152 -0
  167. memoryking/repository_worker.py +57 -0
  168. memoryking/resume_adapter.py +154 -0
  169. memoryking/sdk.py +302 -0
  170. memoryking/shared.py +301 -0
  171. memoryking/shared_sdk.py +101 -0
  172. memoryking/vault.py +176 -0
  173. memoryking-0.1.0.dist-info/METADATA +157 -0
  174. memoryking-0.1.0.dist-info/RECORD +179 -0
  175. memoryking-0.1.0.dist-info/WHEEL +5 -0
  176. memoryking-0.1.0.dist-info/entry_points.txt +7 -0
  177. memoryking-0.1.0.dist-info/licenses/LICENSE +202 -0
  178. memoryking-0.1.0.dist-info/licenses/NOTICE +12 -0
  179. memoryking-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,264 @@
1
+ """Trusted local Git data adapter: no checkout, hooks, filters, builds or fetching."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import hashlib
6
+ import os
7
+ import re
8
+ import shutil
9
+ import stat
10
+ import subprocess
11
+ import tempfile
12
+ import time
13
+ from pathlib import Path
14
+ from typing import Any
15
+ from urllib.parse import urlsplit
16
+
17
+ from memoryking.contracts.canonical import canonical_hash
18
+ from memoryking.domain.local import LocalError
19
+ from memoryking.domain.repository import MAX_FILE_BYTES, PARSER, project_source
20
+ from memoryking.domain.selectors import path_valid
21
+
22
+ MAX_FILES = 2048
23
+ MAX_TOTAL_BYTES = 16 * 1024 * 1024
24
+ MAX_GIT_BYTES = 4 * 1024 * 1024
25
+ MAX_ANCESTORS = 512
26
+
27
+
28
+ def canonical_remote(value: str) -> str:
29
+ if value.startswith("local:") and re.fullmatch(r"local:[A-Za-z0-9_.-]{1,96}", value):
30
+ return value
31
+ if re.fullmatch(r"[^/@:]+@[^/:]+:.+", value):
32
+ user, rest = value.split("@", 1)
33
+ host, path = rest.split(":", 1)
34
+ value = f"ssh://{user}@{host}/{path}"
35
+ parts = urlsplit(value)
36
+ if (
37
+ parts.scheme not in {"https", "ssh"}
38
+ or not parts.hostname
39
+ or parts.query
40
+ or parts.fragment
41
+ or parts.password
42
+ ):
43
+ raise LocalError("repository_identity_invalid")
44
+ if parts.scheme == "https" and parts.username:
45
+ raise LocalError("repository_identity_invalid")
46
+ path = parts.path.strip("/").removesuffix(".git")
47
+ if not path_valid(path) or any(c.isspace() for c in path) or "%" in path:
48
+ raise LocalError("repository_identity_invalid")
49
+ # Normalize the conventional hosted Git account; preserve custom SSH users
50
+ # because their relative repository roots can identify different content.
51
+ # Explicit admin registration is an identity assertion, not remote discovery.
52
+ port = parts.port
53
+ authority = parts.hostname.lower()
54
+ if port is not None and port not in ({22} if parts.scheme == "ssh" else {443}):
55
+ authority += f":{port}"
56
+ if parts.scheme == "ssh" and parts.username != "git":
57
+ user = parts.username or "default-user"
58
+ if not re.fullmatch(r"[A-Za-z0-9_.-]{1,96}", user):
59
+ raise LocalError("repository_identity_invalid")
60
+ authority = f"ssh-{user}@{authority}"
61
+ return f"remote:{authority}/{path}"
62
+
63
+
64
+ class GitSnapshot:
65
+ def __init__(self, root: Path):
66
+ if not root.is_absolute() or root.is_symlink() or not root.is_dir():
67
+ raise LocalError("repository_path_invalid")
68
+ self.root = root.resolve(strict=True)
69
+ git = shutil.which("git")
70
+ if git is None:
71
+ raise LocalError("git_unavailable")
72
+ self.git = git
73
+ self.deadline = time.monotonic() + 12
74
+ top = self.run("rev-parse", "--show-toplevel").decode().strip()
75
+ if Path(top).resolve() != self.root:
76
+ raise LocalError("repository_root_required")
77
+
78
+ def run(self, *args: str) -> bytes:
79
+ remaining = self.deadline - time.monotonic()
80
+ if remaining <= 0:
81
+ raise LocalError("repository_capture_limit")
82
+ env = {
83
+ "PATH": os.defpath,
84
+ "LANG": "C",
85
+ "LC_ALL": "C",
86
+ "GIT_CONFIG_NOSYSTEM": "1",
87
+ "GIT_CONFIG_GLOBAL": os.devnull,
88
+ "GIT_CONFIG_SYSTEM": os.devnull,
89
+ "GIT_NO_REPLACE_OBJECTS": "1",
90
+ "GIT_NO_LAZY_FETCH": "1",
91
+ "GIT_TERMINAL_PROMPT": "0",
92
+ "GIT_OPTIONAL_LOCKS": "0",
93
+ }
94
+ command = [
95
+ self.git,
96
+ "--no-optional-locks",
97
+ "-c",
98
+ "core.fsmonitor=false",
99
+ "-c",
100
+ "core.hooksPath=/dev/null",
101
+ "-c",
102
+ "core.untrackedCache=false",
103
+ "-c",
104
+ "protocol.allow=never",
105
+ "-c",
106
+ "core.pager=cat",
107
+ "-C",
108
+ str(self.root),
109
+ *args,
110
+ ]
111
+ # Spool to private temporary files, bounding memory and process duration.
112
+ # Poll size so hostile repository metadata cannot grow output without bound.
113
+ with tempfile.TemporaryFile() as out, tempfile.TemporaryFile() as err:
114
+ proc = subprocess.Popen(
115
+ command, stdin=subprocess.DEVNULL, stdout=out, stderr=err, env=env
116
+ )
117
+ try:
118
+ while proc.poll() is None:
119
+ if (
120
+ time.monotonic() >= self.deadline
121
+ or os.fstat(out.fileno()).st_size > MAX_GIT_BYTES
122
+ or os.fstat(err.fileno()).st_size > MAX_GIT_BYTES
123
+ ):
124
+ raise LocalError("repository_capture_limit")
125
+ time.sleep(0.005)
126
+ if proc.returncode or os.fstat(out.fileno()).st_size > MAX_GIT_BYTES:
127
+ raise LocalError("repository_data_unavailable")
128
+ out.seek(0)
129
+ return out.read(MAX_GIT_BYTES + 1)
130
+ finally:
131
+ if proc.poll() is None:
132
+ proc.kill()
133
+ proc.wait()
134
+
135
+ def _paths(self) -> list[str]:
136
+ raw = self.run("ls-files", "--cached", "--others", "--exclude-standard", "-z")
137
+ try:
138
+ paths = sorted(set(p.decode("utf-8") for p in raw.split(b"\0") if p))
139
+ except UnicodeError as exc:
140
+ raise LocalError("repository_paths_unsupported") from exc
141
+ if len(paths) > MAX_FILES or any(
142
+ not path_valid(p) or ".git" in p.split("/") for p in paths
143
+ ):
144
+ raise LocalError("repository_capture_limit")
145
+ return paths
146
+
147
+ def _read(self, path: str) -> tuple[bytes | None, str]:
148
+ if time.monotonic() >= self.deadline:
149
+ raise LocalError("repository_capture_limit")
150
+ # Walk using directory descriptors and NOFOLLOW at every component. Never
151
+ # traverse submodules, symlinks, devices or a path swapped outside the root.
152
+ fd = os.open(self.root, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW)
153
+ try:
154
+ parts = path.split("/")
155
+ for part in parts[:-1]:
156
+ new = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=fd)
157
+ os.close(fd)
158
+ fd = new
159
+ file_fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=fd)
160
+ try:
161
+ before = os.fstat(file_fd)
162
+ if not stat.S_ISREG(before.st_mode):
163
+ return None, "unsupported_file_type"
164
+ if before.st_size > MAX_FILE_BYTES:
165
+ return None, "size_limit"
166
+ with os.fdopen(file_fd, "rb", closefd=False) as stream:
167
+ raw = stream.read(MAX_FILE_BYTES + 1)
168
+ after = os.fstat(file_fd)
169
+ if len(raw) > MAX_FILE_BYTES or (
170
+ before.st_dev,
171
+ before.st_ino,
172
+ before.st_size,
173
+ before.st_mtime_ns,
174
+ before.st_ctime_ns,
175
+ ) != (
176
+ after.st_dev,
177
+ after.st_ino,
178
+ after.st_size,
179
+ after.st_mtime_ns,
180
+ after.st_ctime_ns,
181
+ ):
182
+ raise LocalError("repository_changed_during_capture")
183
+ return raw, "regular"
184
+ finally:
185
+ os.close(file_fd)
186
+ except FileNotFoundError:
187
+ return None, "missing"
188
+ except OSError:
189
+ return None, "unsupported_file_type"
190
+ finally:
191
+ os.close(fd)
192
+
193
+ def capture(self, repository: str, environment: str) -> dict[str, Any]:
194
+ head = self.run("rev-parse", "--verify", "HEAD^{commit}").decode().strip()
195
+ paths = self._paths()
196
+ algorithm = "sha256" if len(head) == 64 else "sha1"
197
+ files: dict[str, Any] = {}
198
+ total = 0
199
+ projection_bytes = 0
200
+ for path in paths:
201
+ raw, kind = self._read(path)
202
+ if raw is None:
203
+ files[path] = {"hash": None, "coverage": kind, "symbols": []}
204
+ else:
205
+ total += len(raw)
206
+ if total > MAX_TOTAL_BYTES or time.monotonic() > self.deadline:
207
+ raise LocalError("repository_capture_limit")
208
+ files[path] = project_source(path, raw)
209
+ files[path]["git_blob"] = hashlib.new(
210
+ algorithm, b"blob " + str(len(raw)).encode() + b"\0" + raw
211
+ ).hexdigest()
212
+ projection_bytes += len(str(files[path]).encode())
213
+ if projection_bytes > 524288:
214
+ raise LocalError("repository_projection_limit")
215
+ files[path]["executable"] = bool((self.root / path).lstat().st_mode & 0o111)
216
+ # Re-read to reject observed races; no OS snapshot is claimed. Later edits
217
+ # do not mutate this captured manifest and require a new capture.
218
+ for path in paths:
219
+ raw, kind = self._read(path)
220
+ if (hashlib.sha256(raw).hexdigest() if raw is not None else None) != files[path][
221
+ "hash"
222
+ ] or (raw is None and kind != files[path]["coverage"]):
223
+ raise LocalError("repository_changed_during_capture")
224
+ if (
225
+ head != self.run("rev-parse", "--verify", "HEAD^{commit}").decode().strip()
226
+ or paths != self._paths()
227
+ ):
228
+ raise LocalError("repository_changed_during_capture")
229
+ ancestors = (
230
+ self.run("rev-list", f"--max-count={MAX_ANCESTORS + 1}", "HEAD").decode().splitlines()
231
+ )
232
+ shallow = self.run("rev-parse", "--is-shallow-repository").strip() == b"true"
233
+ tree = self.run("ls-tree", "-r", "-z", "HEAD")
234
+ tracked: dict[str, tuple[str, str]] = {}
235
+ for entry in tree.split(b"\0"):
236
+ if entry:
237
+ meta, name = entry.split(b"\t", 1)
238
+ mode, kind, oid = meta.decode().split()
239
+ tracked[name.decode()] = (mode, oid if kind == "blob" else "unsupported")
240
+ # Git blob IDs are computed locally from bytes; filters are never invoked.
241
+ clean = set(paths) == set(tracked)
242
+ dirty_paths = []
243
+ for path in paths:
244
+ expected_mode = "100755" if files[path].get("executable") else "100644"
245
+ same = tracked.get(path) == (expected_mode, files[path].get("git_blob"))
246
+ clean &= same
247
+ if not same:
248
+ dirty_paths.append(path)
249
+ manifest = {
250
+ "version": 1,
251
+ "repository": repository,
252
+ "commit": head,
253
+ "environment": environment,
254
+ "parser": PARSER,
255
+ "files": files,
256
+ "dirty": not clean,
257
+ "dirty_paths": dirty_paths,
258
+ "ancestors": ancestors[:MAX_ANCESTORS],
259
+ "ancestry_complete": not shallow and len(ancestors) <= MAX_ANCESTORS,
260
+ "ignored_untracked": "excluded",
261
+ "atomic_filesystem_snapshot": False,
262
+ }
263
+ manifest["snapshot"] = "snap_" + canonical_hash(manifest)
264
+ return manifest
@@ -0,0 +1,25 @@
1
+ BEGIN IMMEDIATE;
2
+ CREATE TABLE IF NOT EXISTS repositories (tenant TEXT NOT NULL REFERENCES tenants, id TEXT NOT NULL,
3
+ project TEXT NOT NULL, remote TEXT NOT NULL, readers TEXT NOT NULL, generation INTEGER NOT NULL DEFAULT 0,
4
+ current_incarnation TEXT, current_snapshot TEXT,
5
+ PRIMARY KEY(tenant,id), UNIQUE(tenant,project,remote));
6
+ CREATE TABLE IF NOT EXISTS repository_clones (tenant TEXT NOT NULL, repository TEXT NOT NULL, alias TEXT NOT NULL,
7
+ path TEXT NOT NULL, device INTEGER NOT NULL, inode INTEGER NOT NULL,
8
+ PRIMARY KEY(tenant,repository,alias), UNIQUE(tenant,path),
9
+ FOREIGN KEY(tenant,repository) REFERENCES repositories(tenant,id));
10
+ CREATE TABLE IF NOT EXISTS repository_snapshots (tenant TEXT NOT NULL, incarnation TEXT NOT NULL, repository TEXT NOT NULL,
11
+ id TEXT NOT NULL, generation INTEGER NOT NULL, position INTEGER NOT NULL, body TEXT NOT NULL,
12
+ PRIMARY KEY(tenant,incarnation,repository,id), FOREIGN KEY(tenant,repository) REFERENCES repositories(tenant,id));
13
+ CREATE TABLE IF NOT EXISTS code_policies (tenant TEXT NOT NULL, revision TEXT NOT NULL, repository TEXT NOT NULL,
14
+ origin TEXT NOT NULL, version INTEGER NOT NULL, impact TEXT NOT NULL, dependencies TEXT NOT NULL,
15
+ evidence TEXT NOT NULL, actor TEXT NOT NULL, PRIMARY KEY(tenant,revision),
16
+ FOREIGN KEY(tenant,revision) REFERENCES revisions(tenant,id), FOREIGN KEY(tenant,repository) REFERENCES repositories(tenant,id));
17
+ CREATE TABLE IF NOT EXISTS code_validations (tenant TEXT NOT NULL, incarnation TEXT NOT NULL, revision TEXT NOT NULL,
18
+ snapshot TEXT NOT NULL, policy INTEGER NOT NULL, state TEXT NOT NULL, evidence TEXT NOT NULL,
19
+ expires INTEGER NOT NULL, reason TEXT NOT NULL, generation INTEGER NOT NULL,
20
+ PRIMARY KEY(tenant,incarnation,revision,snapshot,policy), FOREIGN KEY(tenant,revision) REFERENCES revisions(tenant,id));
21
+ CREATE TABLE IF NOT EXISTS repository_jobs (tenant TEXT NOT NULL, incarnation TEXT NOT NULL, repository TEXT NOT NULL,
22
+ snapshot TEXT NOT NULL, generation INTEGER NOT NULL, state TEXT NOT NULL,
23
+ PRIMARY KEY(tenant,incarnation,repository,snapshot,generation));
24
+ PRAGMA user_version=6;
25
+ COMMIT;