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.
- memoryking/__init__.py +3 -0
- memoryking/__main__.py +1328 -0
- memoryking/adapters/__init__.py +1 -0
- memoryking/adapters/adapter_state.py +242 -0
- memoryking/adapters/anchor_schema.sql +7 -0
- memoryking/adapters/atlas.py +441 -0
- memoryking/adapters/browser_commands.py +125 -0
- memoryking/adapters/dashboard.py +510 -0
- memoryking/adapters/dense_search.py +86 -0
- memoryking/adapters/egress_policy.py +244 -0
- memoryking/adapters/egress_schema.sql +13 -0
- memoryking/adapters/embedding.schema.json +302 -0
- memoryking/adapters/embedding_store.py +469 -0
- memoryking/adapters/execution.py +369 -0
- memoryking/adapters/experience.py +423 -0
- memoryking/adapters/experience.schema.json +1508 -0
- memoryking/adapters/experience_records.py +239 -0
- memoryking/adapters/experience_schema.sql +23 -0
- memoryking/adapters/handoff.py +494 -0
- memoryking/adapters/handoff.schema.json +299 -0
- memoryking/adapters/handoff_schema.sql +17 -0
- memoryking/adapters/index_schema.sql +11 -0
- memoryking/adapters/inference.py +454 -0
- memoryking/adapters/inference.schema.json +541 -0
- memoryking/adapters/inspection.py +1128 -0
- memoryking/adapters/inspection.schema.json +568 -0
- memoryking/adapters/knowledge.schema.json +633 -0
- memoryking/adapters/knowledge_schema.sql +37 -0
- memoryking/adapters/knowledge_store.py +800 -0
- memoryking/adapters/legacy_snapshot.py +358 -0
- memoryking/adapters/legacy_tables.py +49 -0
- memoryking/adapters/local_contract.py +45 -0
- memoryking/adapters/local_embeddings.py +189 -0
- memoryking/adapters/local_files.py +242 -0
- memoryking/adapters/local_ipc.py +258 -0
- memoryking/adapters/local_schema.sql +44 -0
- memoryking/adapters/local_store.py +632 -0
- memoryking/adapters/local_wire.schema.json +7672 -0
- memoryking/adapters/models/minilm-l6-v2-onnx.json +57 -0
- memoryking/adapters/models/ms-marco-minilm-l6-v2-onnx.json +57 -0
- memoryking/adapters/optional_schema.sql +43 -0
- memoryking/adapters/plan_dashboard.py +51 -0
- memoryking/adapters/plans.py +253 -0
- memoryking/adapters/postgres_admin.py +300 -0
- memoryking/adapters/postgres_anchor_schema.sql +9 -0
- memoryking/adapters/postgres_counter.sql +14 -0
- memoryking/adapters/postgres_egress_schema.sql +15 -0
- memoryking/adapters/postgres_experience_schema.sql +39 -0
- memoryking/adapters/postgres_index_schema.sql +7 -0
- memoryking/adapters/postgres_optional_schema.sql +71 -0
- memoryking/adapters/postgres_pool.py +77 -0
- memoryking/adapters/postgres_recovery.py +525 -0
- memoryking/adapters/postgres_schema.sql +365 -0
- memoryking/adapters/postgres_sql.py +102 -0
- memoryking/adapters/postgres_store.py +428 -0
- memoryking/adapters/postgres_summary_schema.sql +12 -0
- memoryking/adapters/postgres_trust_schema.sql +20 -0
- memoryking/adapters/processing.schema.json +471 -0
- memoryking/adapters/processing_store.py +346 -0
- memoryking/adapters/projects.py +83 -0
- memoryking/adapters/proposals.py +238 -0
- memoryking/adapters/ranking.py +315 -0
- memoryking/adapters/repository.schema.json +664 -0
- memoryking/adapters/repository_git.py +264 -0
- memoryking/adapters/repository_schema.sql +25 -0
- memoryking/adapters/repository_store.py +960 -0
- memoryking/adapters/retrieval.py +1285 -0
- memoryking/adapters/retrieval.schema.json +553 -0
- memoryking/adapters/retrieval_schema.sql +10 -0
- memoryking/adapters/shared_control.py +40 -0
- memoryking/adapters/shared_dashboard.py +636 -0
- memoryking/adapters/shared_gateway.py +63 -0
- memoryking/adapters/shared_http.py +216 -0
- memoryking/adapters/shared_mcp.py +159 -0
- memoryking/adapters/shared_service.py +124 -0
- memoryking/adapters/stdio.py +193 -0
- memoryking/adapters/stdio.tools.json +6776 -0
- memoryking/adapters/summary_schema.sql +10 -0
- memoryking/adapters/team.py +253 -0
- memoryking/adapters/timeline.py +80 -0
- memoryking/adapters/token_count.py +55 -0
- memoryking/adapters/tokenizers/LICENSE +21 -0
- memoryking/adapters/tokenizers/cl100k_base.tiktoken +100256 -0
- memoryking/adapters/trust.py +123 -0
- memoryking/adapters/trust_schema.sql +13 -0
- memoryking/adapters/web/app.css +1251 -0
- memoryking/adapters/web/app.js +907 -0
- memoryking/adapters/web/brand.js +44 -0
- memoryking/adapters/web/crown-mono.svg +1 -0
- memoryking/adapters/web/crown.svg +8 -0
- memoryking/adapters/web/elephant.png +0 -0
- memoryking/adapters/web/favicon.svg +8 -0
- memoryking/adapters/web/graph-layout.js +52 -0
- memoryking/adapters/web/graph-worker.js +10 -0
- memoryking/adapters/web/graph.js +570 -0
- memoryking/adapters/web/index.html +208 -0
- memoryking/adapters/web/observatory.js +1208 -0
- memoryking/adapters/web/team.js +151 -0
- memoryking/adapters/web/wordmark.svg +1 -0
- memoryking/adapters/working.py +971 -0
- memoryking/adapters/working.schema.json +1717 -0
- memoryking/adapters/working_schema.sql +24 -0
- memoryking/application/__init__.py +1 -0
- memoryking/application/conformance.py +50 -0
- memoryking/application/legacy_import.py +337 -0
- memoryking/application/local_port.py +9 -0
- memoryking/application/storage.py +117 -0
- memoryking/application/store_core.py +1292 -0
- memoryking/backups.py +131 -0
- memoryking/contracts/__init__.py +6 -0
- memoryking/contracts/__main__.py +20 -0
- memoryking/contracts/canonical.py +88 -0
- memoryking/contracts/embedding.schema.json +302 -0
- memoryking/contracts/embedding_generated.py +65 -0
- memoryking/contracts/experience.schema.json +1508 -0
- memoryking/contracts/experience_generated.py +239 -0
- memoryking/contracts/generated.py +122 -0
- memoryking/contracts/handoff.schema.json +299 -0
- memoryking/contracts/handoff_generated.py +69 -0
- memoryking/contracts/inference.schema.json +541 -0
- memoryking/contracts/inference_generated.py +106 -0
- memoryking/contracts/processing.schema.json +471 -0
- memoryking/contracts/processing_generated.py +82 -0
- memoryking/contracts/py.typed +0 -0
- memoryking/contracts/repository.schema.json +664 -0
- memoryking/contracts/repository_generated.py +144 -0
- memoryking/contracts/retrieval.schema.json +553 -0
- memoryking/contracts/retrieval_generated.py +110 -0
- memoryking/contracts/schema.json +696 -0
- memoryking/contracts/validation.py +92 -0
- memoryking/contracts/working.schema.json +1717 -0
- memoryking/contracts/working_generated.py +291 -0
- memoryking/domain/__init__.py +1 -0
- memoryking/domain/anchors.py +97 -0
- memoryking/domain/briefing.py +108 -0
- memoryking/domain/briefing_text.py +222 -0
- memoryking/domain/checkpoint.py +118 -0
- memoryking/domain/compression.py +64 -0
- memoryking/domain/delta.py +129 -0
- memoryking/domain/embeddings.py +90 -0
- memoryking/domain/hints.py +465 -0
- memoryking/domain/http_status.py +45 -0
- memoryking/domain/learning.py +62 -0
- memoryking/domain/local.py +65 -0
- memoryking/domain/plans.py +140 -0
- memoryking/domain/repository.py +118 -0
- memoryking/domain/selectors.py +356 -0
- memoryking/domain/summary.py +88 -0
- memoryking/domain/usage.py +163 -0
- memoryking/embedding_loop.py +98 -0
- memoryking/embedding_worker.py +131 -0
- memoryking/harness.py +882 -0
- memoryking/harness_context.py +376 -0
- memoryking/hooks.py +171 -0
- memoryking/host_hooks.py +454 -0
- memoryking/lean.py +352 -0
- memoryking/memory_tool.py +776 -0
- memoryking/migration.py +194 -0
- memoryking/model_install.py +78 -0
- memoryking/observability.py +101 -0
- memoryking/observability_metrics.py +100 -0
- memoryking/profiles.py +150 -0
- memoryking/providers.py +330 -0
- memoryking/py.typed +0 -0
- memoryking/pytest_plugin.py +69 -0
- memoryking/reference_agent.py +152 -0
- memoryking/repository_worker.py +57 -0
- memoryking/resume_adapter.py +154 -0
- memoryking/sdk.py +302 -0
- memoryking/shared.py +301 -0
- memoryking/shared_sdk.py +101 -0
- memoryking/vault.py +176 -0
- memoryking-0.1.0.dist-info/METADATA +157 -0
- memoryking-0.1.0.dist-info/RECORD +179 -0
- memoryking-0.1.0.dist-info/WHEEL +5 -0
- memoryking-0.1.0.dist-info/entry_points.txt +7 -0
- memoryking-0.1.0.dist-info/licenses/LICENSE +202 -0
- memoryking-0.1.0.dist-info/licenses/NOTICE +12 -0
- memoryking-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
"""One actionable line per error code.
|
|
2
|
+
|
|
3
|
+
Every code the service can return maps to a hint that says what the code means and the
|
|
4
|
+
next move. Replies carry the hint beside the code, and `docs/error-codes.md` is generated
|
|
5
|
+
from this table so the documentation can never drift from what the software says.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
HINTS: dict[str, str] = {
|
|
11
|
+
# Authorization and identity
|
|
12
|
+
"denied": "The credential lacks the capability or project for this action; use a credential with the right grant or ask the owner for one.",
|
|
13
|
+
"credential_required": "Send a credential: Bearer header on HTTP, `credential` on the socket, or `--credential` on the CLI.",
|
|
14
|
+
"credential_audience_mismatch": "The credential was issued for a different service audience; use one issued by this deployment.",
|
|
15
|
+
"credential_output_exists": "The output file already exists; choose a new private file name.",
|
|
16
|
+
"credential_output_required": "A grant returns a secret; pass `--credential-output NEW_FILE` to save it privately.",
|
|
17
|
+
"new_credential_output_required": "Pass a new, non-existent `--credential-output` file for the issued secret.",
|
|
18
|
+
"new_bootstrap_output_required": "Pass a new, non-existent `--bootstrap-output` file for the one-use code.",
|
|
19
|
+
"invalid_token": "The token is malformed, signed by another store, or too long; obtain a fresh credential from this store.",
|
|
20
|
+
"invalid_capabilities": "Capabilities must be a non-empty list of known names without admin; see the deployment guide.",
|
|
21
|
+
"invalid_delegation": "A delegation must narrow an existing grant with a bounded ttl_ms; check the caller's own capabilities.",
|
|
22
|
+
"delegation_depth_exceeded": "Delegated credentials cannot delegate again; request a grant from an administrator.",
|
|
23
|
+
"administrative_operation_required": "This action needs an administrator credential with a tenant-wide grant.",
|
|
24
|
+
"session_required": "Sign in to the dashboard first; the request carried no session cookie.",
|
|
25
|
+
"session_expired": "The dashboard session passed its 15-minute limit; sign in again with a new one-use code.",
|
|
26
|
+
"session_changed": "Permissions or history changed since sign-in and the view was cleared; sign in again.",
|
|
27
|
+
"session_limit": "Sixteen dashboard sessions are already open; sign out of one or wait for expiry.",
|
|
28
|
+
"bootstrap_invalid": "The one-use code is wrong, already used, expired, or issued before a permission change; request a new code.",
|
|
29
|
+
"bootstrap_limit": "Too many unused sign-in codes are outstanding; wait a minute and request one again.",
|
|
30
|
+
"csrf_rejected": "The request's CSRF token does not match the session; reload the dashboard and retry.",
|
|
31
|
+
"mixed_authentication": "Send either a session cookie or a bearer credential, never both.",
|
|
32
|
+
"bearer_required": "This endpoint needs an `Authorization: Bearer <credential>` header.",
|
|
33
|
+
"origin_required": "Browser requests must carry an Origin header matching the dashboard's own origin.",
|
|
34
|
+
"origin_rejected": "The Origin header does not match the dashboard's origin; open the dashboard from its printed URL.",
|
|
35
|
+
"dashboard_origin_required": "Configure the exact Origin the shared dashboard accepts with `--origin`.",
|
|
36
|
+
"preflight_rejected": "Only GET, HEAD and POST with a JSON content type are allowed; check the browser request.",
|
|
37
|
+
"host_rejected": "The Host header is not one the service was started with; pass it with `--host` or use the configured name.",
|
|
38
|
+
"explicit_shared_hosts_required": "Start the shared service with at least one `--host` value.",
|
|
39
|
+
"redirect_forbidden": "The shared service URL redirected; use the final HTTPS URL directly.",
|
|
40
|
+
"shared_tls_required": "The shared service requires HTTPS; pass `--tls-cert` and `--tls-key`, or `--loopback-http` for local testing only.",
|
|
41
|
+
"loopback_development_only": "`--loopback-http` works only on a loopback address without TLS flags.",
|
|
42
|
+
"invalid_shared_url": "Use `https://host[:port]` with no path, query, fragment or embedded credentials.",
|
|
43
|
+
"invalid_port": "Choose a port between 1 and 65535.",
|
|
44
|
+
"invalid_pool_configuration": "The connection pool size must be a positive integer.",
|
|
45
|
+
"invalid_secret_file": "The secret file is missing, empty, not private, or not valid text; recreate it with mode 0600.",
|
|
46
|
+
"scope_mismatch": "The request names a different project than the client is bound to; create a client for that project.",
|
|
47
|
+
"history_changed": "The store's history id changed (restore or reset); refresh with memory_status and rebuild context before retrying.",
|
|
48
|
+
"context_changed": "Identity, project or history differs from what the client bound; reconcile and create a fresh client.",
|
|
49
|
+
"incarnation_required": "Send the current history id from memory_status, or let the bridge fill it.",
|
|
50
|
+
# Requests and contracts
|
|
51
|
+
"invalid_request": "The request body does not match its contract; validate against the schema in the reference guide.",
|
|
52
|
+
"invalid_response": "The service returned something unparseable; check the daemon log for a request id.",
|
|
53
|
+
"invalid_identifier": "Identifiers are 1 to 96 ASCII letters, digits, `_` or `-`.",
|
|
54
|
+
"invalid_query": "The query must be a non-empty string within 2,048 characters.",
|
|
55
|
+
"invalid_range": "The requested range is outside the allowed bounds; check the limits table.",
|
|
56
|
+
"invalid_interval": "The interval's start must precede its end.",
|
|
57
|
+
"invalid_scope": "Project, task and run must be consistent identifiers for this stream.",
|
|
58
|
+
"invalid_recorded_position": "The recorded position is not one this store can recognize; take it from a recent receipt.",
|
|
59
|
+
"invalid_content_type": "Send `Content-Type: application/json`.",
|
|
60
|
+
"request_too_large": "The request exceeds 256 KiB; reduce the payload.",
|
|
61
|
+
"request_key_required": "Mutations need a stable `key` so retries replay instead of duplicating.",
|
|
62
|
+
"invalid_tool_arguments": "The tool arguments do not match the catalog schema; compare with the tool's description.",
|
|
63
|
+
"unknown_tool": "No tool with that name; call tools/list for the catalog.",
|
|
64
|
+
"mcp_protocol_unsupported": "The host asked for an MCP protocol version this bridge does not speak.",
|
|
65
|
+
"tool_input_limit": "Tool input exceeds the frame limit; shorten it.",
|
|
66
|
+
"route_unavailable": "No such dashboard route; check the reference guide's endpoint list.",
|
|
67
|
+
"dashboard_action_unsupported": "The dashboard command is not one of the supported browser actions.",
|
|
68
|
+
"invalid_duration": "Use a number followed by m, h or d, for example `45m`, `12h` or `30d`.",
|
|
69
|
+
"profile_unknown": "No profile with that name; run `memoryking profile list` or `profile add`.",
|
|
70
|
+
"profile_config_invalid": "The profiles file must hold `[profiles.NAME]` tables with absolute store and control paths.",
|
|
71
|
+
"store_required": "Pass `--store PATH` or use `--profile NAME`.",
|
|
72
|
+
"control_required": "Pass `--control PATH` or use `--profile NAME`.",
|
|
73
|
+
"socket_required": "Pass `--socket PATH` or use `--profile NAME`.",
|
|
74
|
+
"credential_required_path": "Pass `--credential FILE` or use `--profile NAME`.",
|
|
75
|
+
"project_required": "Pass `--project NAME` or set `MEMORYKING_PROJECT`.",
|
|
76
|
+
# Capacity and timing
|
|
77
|
+
"queue_full": "The tenant has 1,000 unfinished jobs; the daemon drains them between requests, so retry shortly or run a worker.",
|
|
78
|
+
"concurrency_limit": "Four job leases are already live; finish or let them expire before claiming more.",
|
|
79
|
+
"retention_capacity": "A single artifact exceeds the 128 MiB retention cap; reduce the output budget.",
|
|
80
|
+
"operation_capacity": "4,096 operations are open in the tenant; resolve some to succeeded or failed.",
|
|
81
|
+
"operation_scope_capacity": "32 operations are open in this task stream; resolve some before recording more.",
|
|
82
|
+
"checkpoint_capacity": "This stream holds the maximum number of checkpoints; resume and continue from the latest.",
|
|
83
|
+
"handoff_capacity": "Too many handoffs are outstanding for this stream; acknowledge or cancel some.",
|
|
84
|
+
"handoff_view_capacity": "Too many handoff views are retained; let older ones expire.",
|
|
85
|
+
"experience_capacity": "The tenant reached its experience record limit; see the limits table.",
|
|
86
|
+
"experience_record_limit": "The record exceeds the per-record size limit.",
|
|
87
|
+
"experience_response_limit": "The listing exceeds the response limit; narrow the request.",
|
|
88
|
+
"inference_capacity": "Too many inference permits are outstanding; consume or let them expire.",
|
|
89
|
+
"summary_source_invalid": "A provider-written summary must be the exact reply recorded in a delivered egress audit for this principal and project; pass the permit and the unmodified text.",
|
|
90
|
+
"summary_unavailable": "No session summary is visible for that checkpoint; derive one with `summarize` or check the readers.",
|
|
91
|
+
"egress_policy_invalid": "The egress policy file is malformed: check revision, provider names, hosts, models, classification ceilings and that plain HTTP is loopback-only.",
|
|
92
|
+
"egress_provider_denied": "The provider or model is not in the daemon's egress policy; add it to the policy file and restart `serve --egress-policy`.",
|
|
93
|
+
"egress_classification_denied": "A message cites content above the provider's classification ceiling; rebuild the conversation without it or raise the ceiling in the policy.",
|
|
94
|
+
"egress_audit_missing": "No egress audit record matches that permit for this principal; report only permits you consumed.",
|
|
95
|
+
"egress_audit_reported": "That egress audit record already has a final outcome; a report is written once.",
|
|
96
|
+
"provider_credential_missing": "The adapter's key or token file is missing or unreadable; check key_file, token_file or token_command in the policy.",
|
|
97
|
+
"provider_unavailable": "The provider did not answer within the timeout or returned an error; the dispatch was not retried.",
|
|
98
|
+
"provider_response_invalid": "The provider's reply was not the expected shape or exceeded the size bound; nothing was admitted to the conversation.",
|
|
99
|
+
"ranking_limit": "The ranking request exceeds its bound; reduce cases or votes.",
|
|
100
|
+
"usage_retention_limit": "100,000 usage attempts are retained; expired rows are pruned automatically, otherwise wait for retention to pass.",
|
|
101
|
+
"usage_cohort_limit": "The usage cohort is full; start a new cohort.",
|
|
102
|
+
"service_busy": "The service is at its concurrency bound; back off briefly and retry.",
|
|
103
|
+
"service_unavailable": "The service failed internally; find the request id in the daemon log.",
|
|
104
|
+
"release_expired": "More than five seconds passed between authorization and delivery; request again.",
|
|
105
|
+
"clock_untrusted": "The system clock moved backwards or disagrees with monotonic time; fix the clock and retry.",
|
|
106
|
+
"counter_exhausted": "The commit counter reached its maximum; restore into a fresh store.",
|
|
107
|
+
"journal_record_limit": "The policy action exceeds 256 KiB and was refused before writing; reduce its payload.",
|
|
108
|
+
"diagnostic_limit": "Retrieval diagnostics exceed 64 KiB; reduce the request's breadth.",
|
|
109
|
+
"inspection_response_limit": "The inspection result is too large; narrow the window.",
|
|
110
|
+
"selector_limit_exceeded": "Selectors allow 16 clauses, 8 atoms per clause and 16 KiB in all.",
|
|
111
|
+
"selector_empty": "A selector needs at least one clause.",
|
|
112
|
+
"selector_unsupported": "Only selector_version 1 with any_of/all_of clauses is supported.",
|
|
113
|
+
"binding_coverage_incomplete": "Bindings must be 1 to 256 objects within 128 KiB; cover each selector field once.",
|
|
114
|
+
"invalid_binding": "Binding values are strings of at most 256 bytes over known fields.",
|
|
115
|
+
"dependency_coverage_incomplete": "Not every declared dependency could be bound; supply the missing bindings.",
|
|
116
|
+
# Idempotency and retries
|
|
117
|
+
"idempotency_conflict": "The same key was used with different bytes; investigate rather than inventing a new key.",
|
|
118
|
+
"idempotency_result_expired": "The replay body for this key expired; the identity stays consumed, so reconcile instead of repeating.",
|
|
119
|
+
"source_conflict": "The same source event was captured with different text; keep source identities stable.",
|
|
120
|
+
"source_retired": "This source event was purged and cannot be recaptured.",
|
|
121
|
+
"operation_identity_consumed": "The operation id was already recorded; use the recorded one or a new id.",
|
|
122
|
+
"operation_already_recorded": "This operation already exists with the same identity.",
|
|
123
|
+
"usage_attempt_conflict": "The usage attempt id was reused with different provenance.",
|
|
124
|
+
"usage_attempt_duplicate": "The usage attempt was already recorded.",
|
|
125
|
+
"stale_lease": "The job lease expired or was fenced; claim again and discard stale output.",
|
|
126
|
+
"stale_source": "The job's source changed or was purged; claim again.",
|
|
127
|
+
"handoff_superseded": "A newer handoff replaced this one; use the latest.",
|
|
128
|
+
"ranking_feedback_superseded": "Newer feedback exists for this item; vote on the current revision.",
|
|
129
|
+
"retention_preview_stale": "The purge preview no longer matches the store; request a new preview.",
|
|
130
|
+
# Knowledge, claims and evidence
|
|
131
|
+
"evidence_unavailable": "Cited evidence is missing, purged, or not readable by this principal.",
|
|
132
|
+
"evidence_changed": "The evidence bytes differ from the cited hash; re-cite the current content.",
|
|
133
|
+
"invalid_evidence_span": "An evidence span needs an observation, byte range and content hash that match the text.",
|
|
134
|
+
"acceptance_evidence_required": "A passed acceptance criterion must cite evidence.",
|
|
135
|
+
"verification_evidence_required": "A passed verification must cite evidence.",
|
|
136
|
+
"verification_expired": "The verification's validity window ended; verify again.",
|
|
137
|
+
"waiver_decision_required": "A waived criterion must record who decided and why.",
|
|
138
|
+
"duplicate_criterion": "Acceptance criteria ids must be unique within a checkpoint.",
|
|
139
|
+
"breadth_review_required": "Reviews must confirm breadth_reviewed for claims of this authority.",
|
|
140
|
+
"family_kind_mismatch": "A revision must keep its family's kind (guide, constraint, procedure).",
|
|
141
|
+
"family_version_conflict": "expected_version is behind the family; read the current version and retry.",
|
|
142
|
+
"replacement_out_of_range": "A partial replacement must select within the predecessor's selector.",
|
|
143
|
+
"unrelated_replacement": "Only a proposed successor in the same family can replace a claim.",
|
|
144
|
+
"invalid_constraint": "Constraints need a rule key, value and effect.",
|
|
145
|
+
"invalid_transition": "That lifecycle transition is not allowed from the current state.",
|
|
146
|
+
"knowledge_reconciliation_required": "Knowledge state changed under a restore; reconcile before reviewing.",
|
|
147
|
+
"optional_claim_conflict": "Two optional claims disagree; resolve the conflict or review one.",
|
|
148
|
+
"optional_claim_sources_incomplete": "The optional claim cites sources that are not all available.",
|
|
149
|
+
"optional_claim_unavailable": "The optional claim is not visible to this principal.",
|
|
150
|
+
"optional_source_limit": "Too many optional sources; reduce the set.",
|
|
151
|
+
"optional_source_not_text": "An optional source must be text.",
|
|
152
|
+
"optional_source_unavailable": "An optional source is missing or unreadable.",
|
|
153
|
+
"procedure_case_ambiguous": "More than one procedure matches; add bindings to disambiguate.",
|
|
154
|
+
"procedure_review_required": "Activate only reviewed procedures.",
|
|
155
|
+
"procedure_support_required": "The procedure's supporting evidence is missing.",
|
|
156
|
+
"procedure_unavailable": "The procedure was purged or is not visible.",
|
|
157
|
+
"procedure_validation_required": "Bindings did not validate against the procedure's selector.",
|
|
158
|
+
"impact_downgrade_requires_new_revision": "Lowering impact needs a new revision, not an edit.",
|
|
159
|
+
"feedback_reference_not_retrieved": "Feedback must reference an item delivered in a briefing to this principal.",
|
|
160
|
+
"feedback_scope_mismatch": "Feedback must match the task and run of the referenced briefing.",
|
|
161
|
+
"feedback_use_required": "State whether the memory was used and how useful it was.",
|
|
162
|
+
"applicability_unknown": "Supply bindings for the fields the policy's selectors depend on.",
|
|
163
|
+
"essential_context_unavailable": "A mandatory constraint is not readable by this principal; ask its owner for access.",
|
|
164
|
+
"constraint_resolution_incomplete": "Not all mandatory constraints could be resolved; the result is blocked, not truncated.",
|
|
165
|
+
"constraint_conflict": "Mandatory constraints conflict; a reviewer must resolve them.",
|
|
166
|
+
"index_not_ready": "The dense index has not caught up; wait or use lexical retrieval.",
|
|
167
|
+
"budget_insufficient": "The required content does not fit the token budget; raise max_output_tokens or narrow scope.",
|
|
168
|
+
"no_relevant_memory": "Nothing matched the query under the current permissions; an empty result can be correct.",
|
|
169
|
+
"temporal_requirement_failed": "A claim's validity window does not cover the requested time.",
|
|
170
|
+
# Checkpoints, operations and handoffs
|
|
171
|
+
"checkpoint_unavailable": "No usable checkpoint for this task; save one or check the task identity.",
|
|
172
|
+
"checkpoint_revision_conflict": "Someone saved a newer checkpoint; resume, merge, and save with the current expected_revision.",
|
|
173
|
+
"checkpoint_dependency_limit": "A checkpoint may cite at most the documented number of dependencies.",
|
|
174
|
+
"checkpoint_evidence_unavailable": "Evidence cited by the checkpoint is missing or unreadable.",
|
|
175
|
+
"checkpoint_input_limit": "The checkpoint exceeds its size limit; trim findings or attachments.",
|
|
176
|
+
"checkpoint_integrity_failure": "The stored checkpoint does not match its hash; restore from backup.",
|
|
177
|
+
"checkpoint_reconciliation_required": "The checkpoint predates a restore; reconcile its operations first.",
|
|
178
|
+
"checkpoint_writer_audience_required": "The writer must be among the checkpoint's readers.",
|
|
179
|
+
"checkpoint_writer_denied": "Only the stream's writer can save to it; reassign the writer explicitly.",
|
|
180
|
+
# Structured plans
|
|
181
|
+
"plan_unavailable": "No plan on this task stream (or the revision does not exist); save one with plan_save or check the task id.",
|
|
182
|
+
"plan_step_unavailable": "The plan has no step with that id; read the current plan and use a stable step id.",
|
|
183
|
+
"plan_duplicate_id": "Phase and step ids must be unique within a plan.",
|
|
184
|
+
"plan_reference_invalid": "Every step must name an existing phase and existing prerequisite step ids.",
|
|
185
|
+
"plan_reason_required": "A blocked or skipped step needs a note explaining why.",
|
|
186
|
+
"plan_dependency_unresolved": "A step can be doing or done only when every prerequisite is done or skipped.",
|
|
187
|
+
"plan_dependency_cycle": "Step prerequisites form a cycle; remove the circular depends_on link.",
|
|
188
|
+
"plan_unresolved_steps": "A done plan needs at least one step, each done or skipped; finish or skip the rest first.",
|
|
189
|
+
"plan_closure_evidence_required": "Closing a plan as done or abandoned needs a closure note and at least one lesson reference.",
|
|
190
|
+
"plan_reverification_required": "A completed step's definition or prerequisites changed; cite fresh evidence or reopen the step as todo.",
|
|
191
|
+
"plan_stream_type_changed": "A task stream cannot switch between ordinary checkpoints and a plan; use a separate task id.",
|
|
192
|
+
"plan_task_stream_required": "Plans live on the task stream; send run as null.",
|
|
193
|
+
"hook_event_invalid": "The host sent something other than one JSON object on stdin; run the hook from the host, not by hand.",
|
|
194
|
+
"hook_config_invalid": "The host's hook config file is not a JSON object; fix or remove it before installing.",
|
|
195
|
+
"host_unsupported": "Hooks are generated for claude, codex or grok; other hosts can run the same `memoryking hook` commands by hand.",
|
|
196
|
+
"trust_level_invalid": "A source is trusted or untrusted; nothing else.",
|
|
197
|
+
"vault_missing": "The vault directory has no `<project>` folder; export first, or pass the directory that holds it.",
|
|
198
|
+
"hold_unavailable": "No held capture with that id in this project; it was released, purged, or never held.",
|
|
199
|
+
"response_limit": "The plan view exceeds the dashboard response limit; open one plan at a time or page with the cursor.",
|
|
200
|
+
"invalid_checkpoint": "The checkpoint body does not match the contract; start from the fixture shape.",
|
|
201
|
+
"readers_only_at_start": "Readers are fixed when a stream starts; start a new stream to change them.",
|
|
202
|
+
"artifact_availability_invalid": "A stored artifact needs an observation and content hash; an unstored one must have neither.",
|
|
203
|
+
"artifact_reference_required": "Stored artifacts must reference their observation.",
|
|
204
|
+
"artifact_integrity_failure": "The artifact bytes do not match their recorded hash.",
|
|
205
|
+
"artifact_not_utf8": "Artifacts must be UTF-8 text.",
|
|
206
|
+
"artifact_path_invalid": "Artifact paths are relative, normalized and without `..`.",
|
|
207
|
+
"artifact_input_limit": "The artifact exceeds its size limit.",
|
|
208
|
+
"artifact_unavailable": "The artifact is missing or not readable.",
|
|
209
|
+
"operation_unavailable": "No such operation in this stream for this principal.",
|
|
210
|
+
"operation_limit": "Too many operations in one request.",
|
|
211
|
+
"operation_reconciliation_required": "The operation's outcome is unknown after a restart; reconcile it before repeating.",
|
|
212
|
+
"operation_reconciliation_invalid": "A reconciled transition must end in succeeded or failed with evidence.",
|
|
213
|
+
"operation_result_evidence_required": "Succeeded and failed outcomes must cite evidence.",
|
|
214
|
+
"operation_result_invalid": "The result hash or evidence is malformed.",
|
|
215
|
+
"operation_revision_conflict": "The operation moved on; read its current revision and retry.",
|
|
216
|
+
"operation_transition_invalid": "That state change is not allowed from the current state.",
|
|
217
|
+
"invalid_operation_id": "Operation ids are identifiers of at most 96 characters.",
|
|
218
|
+
"handoff_unavailable": "The handoff is missing, purged, or not addressed to this principal.",
|
|
219
|
+
"handoff_expired": "The handoff's ttl passed; prepare a new one.",
|
|
220
|
+
"handoff_ack_invalid": "Acknowledge with the view stamp you received.",
|
|
221
|
+
"handoff_view_stale": "Policy or checkpoint changed since the view; preview again.",
|
|
222
|
+
# Retrieval and replay
|
|
223
|
+
"replay_missing": "No artifact with that receipt for this principal and project.",
|
|
224
|
+
"replay_expired": "The artifact expired or was evicted after 30 days or at capacity; request a fresh briefing.",
|
|
225
|
+
"replay_purged": "A source of the artifact was purged; request a fresh briefing.",
|
|
226
|
+
"replay_denied": "The principal may no longer read a source of the artifact.",
|
|
227
|
+
"replay_integrity_failure": "The retained bytes do not match their hash; restore from backup.",
|
|
228
|
+
"atlas_resync_required": "The atlas cursor is stale; start a new atlas query.",
|
|
229
|
+
"cursor_context_changed": "The paging cursor belongs to another session or history; start over.",
|
|
230
|
+
"delta_base_mismatch": "The delta base is not the retained base; fetch a full packet.",
|
|
231
|
+
"delta_binding_mismatch": "The delta's binding differs from the client's.",
|
|
232
|
+
"delta_invalid": "The delta is malformed.",
|
|
233
|
+
"delta_limit": "The delta exceeds its size or change-count limit; fetch a full packet.",
|
|
234
|
+
"delta_reconstruction_failed": "Applying the delta did not reproduce the target hash; fetch a full packet.",
|
|
235
|
+
"delta_sequence_mismatch": "Deltas must apply in order; fetch the missing ones or a full packet.",
|
|
236
|
+
"delta_target_mismatch": "The reconstructed packet does not match the target.",
|
|
237
|
+
"tokenizer_unavailable": "Install the tokenizers lock for exact counts, or request `utf8-byte-estimate-v1`.",
|
|
238
|
+
"tokenizer_version_unsupported": "The installed tiktoken version differs from the pinned one; install the tokenizers lock.",
|
|
239
|
+
"tokenizer_integrity_failure": "The bundled vocabulary file is corrupt; reinstall the package.",
|
|
240
|
+
"query_term_limit": "Queries are searched on their first 32 distinct terms.",
|
|
241
|
+
# Capture, jobs and sources
|
|
242
|
+
"unavailable": "The record is missing, purged, or not visible to this principal.",
|
|
243
|
+
"blob_corrupt": "Stored content does not match its hash; restore from backup.",
|
|
244
|
+
"snapshot_unchecked": "The snapshot has not been validated; run the validation job first.",
|
|
245
|
+
"invalid_usage": "Usage figures must be consistent non-negative integers.",
|
|
246
|
+
"usage_record_invalid": "The usage record is malformed.",
|
|
247
|
+
"usage_cohort_invalid": "The usage cohort identifier is invalid.",
|
|
248
|
+
"source_manifest_mismatch": "The source manifest hash differs from the retained one.",
|
|
249
|
+
"output_hash_mismatch": "The declared output hash does not match the content.",
|
|
250
|
+
# Repository
|
|
251
|
+
"git_unavailable": "Git is not on PATH; install it or adjust PATH for the daemon.",
|
|
252
|
+
"repository_path_invalid": "The clone path must be an absolute, existing directory and not a symlink.",
|
|
253
|
+
"repository_root_required": "The path must be the repository's top-level directory.",
|
|
254
|
+
"repository_paths_unsupported": "Paths outside the clone or with unsupported characters cannot be captured.",
|
|
255
|
+
"repository_identity_invalid": "The repository identity does not match its registration.",
|
|
256
|
+
"repository_audience_conflict": "Readers differ from the registered repository audience.",
|
|
257
|
+
"repository_audience_invalid": "Repository readers must be identifiers or null.",
|
|
258
|
+
"repository_capture_configuration_missing": "Register a capture configuration before capturing.",
|
|
259
|
+
"repository_capture_limit": "The snapshot exceeds 2,048 files, 16 MiB or 12 seconds; narrow the capture.",
|
|
260
|
+
"repository_projection_limit": "The repository projection exceeds 4 MiB.",
|
|
261
|
+
"repository_changed_during_capture": "Files changed while Git was running; capture again.",
|
|
262
|
+
"repository_clone_changed": "The clone directory was replaced; register it again.",
|
|
263
|
+
"repository_context_mismatch": "The binding's repository context does not match the snapshot.",
|
|
264
|
+
"repository_data_unavailable": "Repository data for this snapshot is missing.",
|
|
265
|
+
"repository_generation_conflict": "A newer snapshot generation exists; capture again.",
|
|
266
|
+
"repository_snapshot_changed": "The snapshot differs from the one the claim was validated against; revalidate.",
|
|
267
|
+
"clone_already_registered": "This clone alias is already registered for the repository.",
|
|
268
|
+
"revalidation_limit": "Too many claims to revalidate in one request; narrow the set.",
|
|
269
|
+
"dependency_policy_conflict": "Declared dependency policies conflict; resolve them.",
|
|
270
|
+
"dependency_policy_missing": "A declared dependency has no policy.",
|
|
271
|
+
"dependency_policy_stale": "The dependency policy predates the current snapshot.",
|
|
272
|
+
"dependency_policy_unsafe": "The dependency policy would widen access; reject or review it.",
|
|
273
|
+
"dependency_unsupported": "This dependency kind is not supported.",
|
|
274
|
+
# Experience and ranking
|
|
275
|
+
"experience_actor_audience_required": "The actor must be among the record's readers.",
|
|
276
|
+
"experience_integrity_failure": "The record does not match its hash.",
|
|
277
|
+
"experience_record_unavailable": "The record is missing, purged, or not visible.",
|
|
278
|
+
"experience_revision_conflict": "A newer revision exists; read it and retry.",
|
|
279
|
+
"ranking_case_invalid": "Each ranking case needs a brief request and disjoint relevant and forbidden sets.",
|
|
280
|
+
"ranking_duplicate_vote": "One vote per actor per item.",
|
|
281
|
+
"ranking_evaluation_required": "Evaluate the configuration and pass its gates before activating.",
|
|
282
|
+
"ranking_not_previously_active": "Rollback needs a previously active configuration.",
|
|
283
|
+
"ranking_policy_unsupported": "Only the documented ranking policy version is supported.",
|
|
284
|
+
"ranking_shadow_stale": "The project changed since the evaluation; evaluate again.",
|
|
285
|
+
"ranking_version_conflict": "expected_version is behind the ranking state; read it and retry.",
|
|
286
|
+
# Inference and harness
|
|
287
|
+
"inference_context_changed": "The conversation's binding changed; rebuild context before dispatch.",
|
|
288
|
+
"inference_dependency_unavailable": "A cited receipt is no longer available; rebuild context.",
|
|
289
|
+
"inference_hash_mismatch": "Message bytes differ from their manifest; rebuild from the retained packets.",
|
|
290
|
+
"inference_manifest_incomplete": "Every message and handle needs a manifest entry.",
|
|
291
|
+
"inference_permit_consumed": "The permit was already used; authorize again.",
|
|
292
|
+
"inference_permit_expired": "The permit expired; authorize again.",
|
|
293
|
+
"inference_permit_mismatch": "The permit was issued for different bytes or binding.",
|
|
294
|
+
"inference_provenance_unknown": "Each message needs a memory artifact or host authorization as provenance.",
|
|
295
|
+
"inference_request_limit": "The conversation is full (128 messages, so 127 before a dispatch), the request exceeds 96 KiB, or the artifact bounds are exceeded.",
|
|
296
|
+
"inference_result_quarantined": "The provider result was quarantined; do not reuse it.",
|
|
297
|
+
"host_authorization_expired": "The host's authorization for this content expired; authorize again.",
|
|
298
|
+
"host_authorization_required": "Host-supplied content needs a host authorization with a source hash.",
|
|
299
|
+
"provider_context_limit": "The provider's stored context exceeds its limit.",
|
|
300
|
+
"provider_handle_invalid": "The provider handle is malformed.",
|
|
301
|
+
"provider_handle_unavailable": "The provider handle's file is missing or unreadable.",
|
|
302
|
+
"provider_not_supported": "Only the local recorder and adapters built from the daemon's current egress policy are accepted; load the policy with `serve --egress-policy` and build the adapter from it.",
|
|
303
|
+
"provider_request_invalid": "The provider request bytes are not the canonical frozen request.",
|
|
304
|
+
"harness_already_exists": "A harness journal already exists at that path.",
|
|
305
|
+
"harness_binding_changed": "The store binding changed under the harness; start again from a checkpoint.",
|
|
306
|
+
"harness_capture_degraded": "Some captures failed; inspect the harness journal.",
|
|
307
|
+
"harness_checkpoint_changed": "The checkpoint changed under the harness; resume first.",
|
|
308
|
+
"harness_closed": "The harness is closed; start a new one.",
|
|
309
|
+
"harness_configuration_invalid": "The harness configuration is malformed.",
|
|
310
|
+
"harness_evidence_capacity": "The harness holds too much evidence; checkpoint and reset.",
|
|
311
|
+
"harness_journal_diverged": "The harness journal differs from the store; recover from the checkpoint.",
|
|
312
|
+
"harness_journal_integrity": "The harness journal is corrupt.",
|
|
313
|
+
"harness_journal_invalid": "The harness journal is malformed.",
|
|
314
|
+
"harness_journal_limit": "The harness journal is full; checkpoint and reset.",
|
|
315
|
+
"harness_provenance_removed": "Provenance for retained content was removed; rebuild context.",
|
|
316
|
+
"harness_recovery_incomplete": "Recovery did not finish; retry with the same checkpoint.",
|
|
317
|
+
"harness_state_required": "Start the harness with an explicit state file.",
|
|
318
|
+
"tool_outside_declared_scope": "The tool touched a path outside its declared root.",
|
|
319
|
+
"tool_path_invalid": "Tool paths must be relative and normalized.",
|
|
320
|
+
"tool_readback_mismatch": "The file read back differs from what was written.",
|
|
321
|
+
"tool_target_exists": "The target file already exists.",
|
|
322
|
+
"context_rebuild_required": "Retained context is no longer authorized; rebuild from current permissions.",
|
|
323
|
+
# Embeddings and processing
|
|
324
|
+
"embedding_batch_invalid": "The batch's items do not match the leased job.",
|
|
325
|
+
"embedding_disabled": "Embeddings are not configured for this project; configure a partition first.",
|
|
326
|
+
"embedding_dispatch_expired": "The embedding lease expired; claim again.",
|
|
327
|
+
"embedding_fingerprint_mismatch": "The model fingerprint differs from the partition's.",
|
|
328
|
+
"embedding_generation_conflict": "The partition moved to a new generation; claim again.",
|
|
329
|
+
"embedding_input_limit": "Embedding inputs are at most 16 KiB each.",
|
|
330
|
+
"embedding_model_checksum_mismatch": "The downloaded model does not match its manifest checksum.",
|
|
331
|
+
"embedding_model_invalid": "The model manifest is malformed.",
|
|
332
|
+
"embedding_model_not_installed": "Install the model with `python -m memoryking.model_install`.",
|
|
333
|
+
"embedding_model_unsupported": "Only the pinned model manifest is supported.",
|
|
334
|
+
"embedding_partition_limit": "Too many embedding partitions.",
|
|
335
|
+
"embedding_partition_unavailable": "No partition for this project and fingerprint.",
|
|
336
|
+
"embedding_provider_failure": "The embedding runtime failed; see the worker log.",
|
|
337
|
+
"embedding_provider_unsupported": "Only the local ONNX runtime is supported.",
|
|
338
|
+
"embedding_query_mismatch": "The query vector's dimension or fingerprint does not match the partition.",
|
|
339
|
+
"embedding_release_invalid": "The embedding release is malformed.",
|
|
340
|
+
"embedding_runtime_mismatch": "The installed runtime differs from the pinned version.",
|
|
341
|
+
"embedding_runtime_unavailable": "Install the embeddings lock to run the local model.",
|
|
342
|
+
"reranker_failure": "The reranker runtime failed on this request; the briefing fell back to the fused order.",
|
|
343
|
+
"reranker_input_limit": "The reranker scores at most 32 texts of at most 16 KiB each per call.",
|
|
344
|
+
"reranker_model_checksum_mismatch": "The reranker files do not match the manifest checksums.",
|
|
345
|
+
"reranker_model_invalid": "The reranker model could not be loaded by the pinned runtime.",
|
|
346
|
+
"reranker_model_not_installed": "Install the reranker with `python -m memoryking.model_install --model reranker --destination DIR`.",
|
|
347
|
+
"embedding_source_unavailable": "The observation to embed is missing or purged.",
|
|
348
|
+
"embedding_vector_invalid": "Vectors must have the model's dimension and finite values.",
|
|
349
|
+
"vector_extension_mismatch": "The pgvector extension version differs from the pinned one.",
|
|
350
|
+
"extension_administrator_required": "Enabling pgvector needs a superuser; run `enable-vector` as one.",
|
|
351
|
+
"model_destination_exists": "The model destination already exists; choose a new directory.",
|
|
352
|
+
"model_download_checksum_mismatch": "A downloaded file's checksum differs from the manifest; retry or check the mirror.",
|
|
353
|
+
"model_download_limit": "A model file exceeds its size limit.",
|
|
354
|
+
"model_download_redirect_denied": "The model download redirected; only direct downloads are allowed.",
|
|
355
|
+
# Storage, journal and recovery
|
|
356
|
+
"recovery_required": "The store is fenced or inconsistent; stop and follow the recovery guide.",
|
|
357
|
+
"journal_invalid": "The policy journal's chain is broken; restore using independent control evidence.",
|
|
358
|
+
"journal_rollback": "The journal is shorter than the anchor records; the control state was rolled back.",
|
|
359
|
+
"journal_replay_required": "Unapplied journal records exist; reopen the store to replay them.",
|
|
360
|
+
"journal_tenant_missing": "A journal record names a tenant the database lacks; restore the matching database.",
|
|
361
|
+
"backup_invalid": "The backup manifest or files failed verification.",
|
|
362
|
+
"backup_archive_limit": "The backup exceeds its archive size limit.",
|
|
363
|
+
"backup_row_limit": "The backup exceeds its row limit.",
|
|
364
|
+
"backup_requires_new_directory": "Back up into a new directory.",
|
|
365
|
+
"backup_requires_new_external_directory": "Back up into a new directory outside the store and control paths.",
|
|
366
|
+
"backup_role_required": "Run backups with the backup database role.",
|
|
367
|
+
"migration_role_required": "Run migrations with the migration database role.",
|
|
368
|
+
"runtime_table_owner_forbidden": "The runtime role must not own tables; use the migration role for schema work.",
|
|
369
|
+
"database_durability_required": "PostgreSQL must run with fsync, synchronous_commit and full_page_writes on.",
|
|
370
|
+
"database_tls_required": "Remote DSNs must use sslmode=verify-full.",
|
|
371
|
+
"database_transaction_required": "This read needs an open store transaction.",
|
|
372
|
+
"unsupported_database_statement": "The statement cannot be translated for PostgreSQL.",
|
|
373
|
+
"exclusive_gate_required": "This operation needs the exclusive tenant gate, not a release-only store.",
|
|
374
|
+
"pool_reset_failed": "A pooled connection could not be reset; restart the service.",
|
|
375
|
+
"primary_required": "Writes must go to the primary database, not a replica.",
|
|
376
|
+
"primary_nonprivileged_runtime_required": "The runtime role must not be a superuser or bypass row security.",
|
|
377
|
+
"schema_unsupported": "The database schema version is newer or older than this release supports; migrate or upgrade.",
|
|
378
|
+
"recovery_admin_missing": "No tenant-wide admin grant exists to receive the recovered credential.",
|
|
379
|
+
"recovery_checkpoint_invalid": "The supplied journal head does not match the journal.",
|
|
380
|
+
"maintenance_operation_mismatch": "Pass the operation id recorded in the anchor's maintenance_operation.",
|
|
381
|
+
"control_busy": "Another process holds the control lock; wait or stop it.",
|
|
382
|
+
"control_must_be_independent": "Store and control directories may not contain each other.",
|
|
383
|
+
"initialization_requires_new_directories": "Initialize into directories that do not exist yet.",
|
|
384
|
+
"inherited_owner_forbidden": "A forked process may not reuse its parent's store ownership.",
|
|
385
|
+
"owner_busy_or_unsafe": "Another process owns the store, or the lock file is not private.",
|
|
386
|
+
"owner_closed": "The store was closed; open it again.",
|
|
387
|
+
"unsafe_permissions": "Directories must be mode 0700 and files 0600, owned by this user.",
|
|
388
|
+
"unsafe_socket": "The socket path exists and is not a socket owned by this user.",
|
|
389
|
+
"socket_path_too_long": "The socket path must fit in 100 bytes; use a shorter store path.",
|
|
390
|
+
"transport_unavailable": "The daemon socket is unreachable; is `memoryking serve` running?",
|
|
391
|
+
"shared_backup_command_required": "Use the shared backup command for PostgreSQL tenants.",
|
|
392
|
+
"shared_migration_command_required": "Use the shared migrate command for PostgreSQL.",
|
|
393
|
+
"shared_restore_command_required": "Use the shared restore command for PostgreSQL tenants.",
|
|
394
|
+
"dashboard_disabled": "Start `serve` with `--dashboard-port` to enable the dashboard.",
|
|
395
|
+
"dashboard_unavailable": "The dashboard failed internally; find the request id in the daemon log.",
|
|
396
|
+
"invalid_dashboard_configuration": "The dashboard port must be between 0 and 65535.",
|
|
397
|
+
"internal_error": "The service failed unexpectedly; find the request id in the daemon log.",
|
|
398
|
+
"local_io_or_configuration_error": "A file or directory could not be read or written; check the path, its permissions, and that the daemon is running.",
|
|
399
|
+
# Legacy import
|
|
400
|
+
"legacy_batch_limit": "Apply at most 500 rows per batch.",
|
|
401
|
+
"legacy_batch_start": "The batch start does not follow the last applied row.",
|
|
402
|
+
"legacy_context_changed": "The target store changed during import; reconcile first.",
|
|
403
|
+
"legacy_incomplete": "The import is incomplete; apply the remaining batches.",
|
|
404
|
+
"legacy_integrity_failed": "The snapshot's hashes do not match the plan.",
|
|
405
|
+
"legacy_journal_corrupt": "The import journal is corrupt; start from a new snapshot directory.",
|
|
406
|
+
"legacy_journal_plan_mismatch": "The journal belongs to a different plan.",
|
|
407
|
+
"legacy_lesson_proposal_limit": "Too many lesson proposals in one batch.",
|
|
408
|
+
"legacy_operator_required": "Import needs an operator credential.",
|
|
409
|
+
"legacy_plan_changed": "The plan changed since the journal started.",
|
|
410
|
+
"legacy_plan_exists_use_new_snapshot_directory": "A plan already exists; use a new snapshot directory.",
|
|
411
|
+
"legacy_reconciliation_required": "Reconcile the import before applying more.",
|
|
412
|
+
"legacy_record_too_large": "A legacy row exceeds 60 KiB.",
|
|
413
|
+
"legacy_reference_missing": "A legacy row references a missing record.",
|
|
414
|
+
"legacy_row_limit": "The source exceeds 10,000 rows.",
|
|
415
|
+
"legacy_shared_tenant_required": "Shared import needs `--tenant`.",
|
|
416
|
+
"legacy_snapshot_destination_or_source_invalid": "The snapshot source or destination path is invalid.",
|
|
417
|
+
"legacy_snapshot_hash_mismatch": "The snapshot file's hash changed since inspection.",
|
|
418
|
+
"legacy_snapshot_invalid": "The snapshot is not a supported SQLite profile.",
|
|
419
|
+
"legacy_snapshot_not_detached": "Snapshot a detached backup, not a live database with a WAL.",
|
|
420
|
+
"legacy_source_changed": "The legacy source changed since planning.",
|
|
421
|
+
"legacy_sqlite_inspection_failed": "The snapshot could not be read as SQLite.",
|
|
422
|
+
"legacy_table_limit": "The source has more than 128 tables.",
|
|
423
|
+
"legacy_target_mismatch": "The plan targets a different store.",
|
|
424
|
+
"legacy_total_limit": "The source exceeds 64 MiB of canonical row data.",
|
|
425
|
+
"legacy_value_unsupported": "A legacy value type is not supported.",
|
|
426
|
+
"transition_invalid": "That state change is not allowed.",
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
FAMILIES: tuple[tuple[str, str], ...] = (
|
|
430
|
+
(
|
|
431
|
+
"_conflict",
|
|
432
|
+
"Another writer changed this record; read the current version and retry with it.",
|
|
433
|
+
),
|
|
434
|
+
("_stale", "The referenced state moved on; refresh and retry."),
|
|
435
|
+
("_changed", "The referenced state changed; reconcile before retrying."),
|
|
436
|
+
(
|
|
437
|
+
"_limit",
|
|
438
|
+
"The request exceeds a documented bound; see the limits table in the reference guide.",
|
|
439
|
+
),
|
|
440
|
+
("_capacity", "A per-tenant bound is full; see the capacity table for how it releases."),
|
|
441
|
+
(
|
|
442
|
+
"_required",
|
|
443
|
+
"A required input or precondition is missing; see the reference guide for this operation.",
|
|
444
|
+
),
|
|
445
|
+
(
|
|
446
|
+
"_unavailable",
|
|
447
|
+
"The referenced record is missing, purged, expired, or not visible to this principal.",
|
|
448
|
+
),
|
|
449
|
+
("_invalid", "The input does not match its contract; validate against the schema."),
|
|
450
|
+
("_mismatch", "Two values that must agree do not; recompute from current state."),
|
|
451
|
+
("_unsupported", "This variant is not supported by this release."),
|
|
452
|
+
)
|
|
453
|
+
|
|
454
|
+
GENERIC = "See the troubleshooting table in the reference guide."
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
def hint(code: str) -> str:
|
|
458
|
+
"""The hint for a code: exact when known, else by family suffix, else generic."""
|
|
459
|
+
exact = HINTS.get(code)
|
|
460
|
+
if exact is not None:
|
|
461
|
+
return exact
|
|
462
|
+
for suffix, text in FAMILIES:
|
|
463
|
+
if code.endswith(suffix):
|
|
464
|
+
return text
|
|
465
|
+
return GENERIC
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""HTTP status for a LocalError code: conflicts, capacity and unavailability stay distinct.
|
|
2
|
+
|
|
3
|
+
Clients should retry 503 after a pause, slow down on 429, and resolve 409 by reconciling.
|
|
4
|
+
Anything else keeps the transport's default, usually 400 or 403.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
CONFLICT_SUFFIXES = ("_conflict", "_stale", "_changed", "_consumed", "_superseded")
|
|
10
|
+
CONFLICT_CODES = {"reconciliation_required", "operation_reconciliation_required"}
|
|
11
|
+
# 429 means "retry later": stored capacity that frees with time or retention, and the
|
|
12
|
+
# few limits that clear on their own. A fixed input bound (tool_input_limit,
|
|
13
|
+
# checkpoint_input_limit, ...) never clears, so it keeps the transport's 400.
|
|
14
|
+
CAPACITY_SUFFIXES = ("_capacity",)
|
|
15
|
+
CAPACITY_CODES = {
|
|
16
|
+
"queue_full",
|
|
17
|
+
"rate_limited",
|
|
18
|
+
"concurrency_limit",
|
|
19
|
+
"session_limit",
|
|
20
|
+
"bootstrap_limit",
|
|
21
|
+
"operation_limit",
|
|
22
|
+
"usage_retention_limit",
|
|
23
|
+
}
|
|
24
|
+
UNAVAILABLE_CODES = {
|
|
25
|
+
"recovery_required",
|
|
26
|
+
"service_busy",
|
|
27
|
+
"service_unavailable",
|
|
28
|
+
"dashboard_unavailable",
|
|
29
|
+
"journal_rollback",
|
|
30
|
+
"owner_busy_or_unsafe",
|
|
31
|
+
"index_not_ready",
|
|
32
|
+
"provider_unavailable",
|
|
33
|
+
"database_durability_required",
|
|
34
|
+
"transport_unavailable",
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def http_status(code: str, default: int) -> int:
|
|
39
|
+
if code in UNAVAILABLE_CODES:
|
|
40
|
+
return 503
|
|
41
|
+
if code in CAPACITY_CODES or code.endswith(CAPACITY_SUFFIXES):
|
|
42
|
+
return 429
|
|
43
|
+
if code in CONFLICT_CODES or code.endswith(CONFLICT_SUFFIXES):
|
|
44
|
+
return 409
|
|
45
|
+
return default
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""Bounded experimental feedback ranking; no online updates or causal inference."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from memoryking.domain.local import LocalError
|
|
8
|
+
|
|
9
|
+
POLICY = "bounded-feedback-v1"
|
|
10
|
+
MAX_ADJUSTMENT = 100000
|
|
11
|
+
LABELS = {"helpful": 100000, "irrelevant": -25000, "misleading": -75000, "harmful": -100000}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def freeze(feedback: list[dict[str, Any]], bound: int) -> dict[str, int]:
|
|
15
|
+
if not 0 <= bound <= MAX_ADJUSTMENT or len(feedback) > 128:
|
|
16
|
+
raise LocalError("ranking_limit")
|
|
17
|
+
# One latest judgment per actor/run/item; average within each actor first.
|
|
18
|
+
# Exposure, read/used without usefulness, and unknown are never positive votes.
|
|
19
|
+
votes: dict[tuple[str, str], list[int]] = {}
|
|
20
|
+
seen: set[tuple[str, str, str, str]] = set()
|
|
21
|
+
for item in feedback:
|
|
22
|
+
key = (item["actor"], item["task"], item["run"], item["reference"])
|
|
23
|
+
if key in seen:
|
|
24
|
+
raise LocalError("ranking_duplicate_vote")
|
|
25
|
+
seen.add(key)
|
|
26
|
+
label = item["usefulness"]
|
|
27
|
+
if label not in LABELS:
|
|
28
|
+
continue
|
|
29
|
+
votes.setdefault((item["actor"], item["reference"]), []).append(LABELS[label])
|
|
30
|
+
actors: dict[str, list[int]] = {}
|
|
31
|
+
for (_, reference), values in votes.items():
|
|
32
|
+
actors.setdefault(reference, []).append(sum(values) // len(values))
|
|
33
|
+
if len(actors) > 64:
|
|
34
|
+
raise LocalError("ranking_limit")
|
|
35
|
+
return {
|
|
36
|
+
reference: max(-bound, min(bound, sum(values) // len(values)))
|
|
37
|
+
for reference, values in sorted(actors.items())
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def adjust(
|
|
42
|
+
ranked: list[tuple[int, str, list[dict[str, Any]]]], adjustments: dict[str, int]
|
|
43
|
+
) -> list[tuple[int, str, list[dict[str, Any]]]]:
|
|
44
|
+
result = []
|
|
45
|
+
for score, reference, group in ranked:
|
|
46
|
+
values = [adjustments.get(item["reference"], 0) for item in group]
|
|
47
|
+
delta = sum(values) // len(values) if values else 0
|
|
48
|
+
if abs(delta) > MAX_ADJUSTMENT:
|
|
49
|
+
raise LocalError("ranking_limit")
|
|
50
|
+
# No relevance floor is crossed, and conflict groups remain indivisible.
|
|
51
|
+
updated = max(1, score * (1000000 + delta) // 1000000) if score > 0 else 0
|
|
52
|
+
result.append((updated, reference, group))
|
|
53
|
+
return sorted(result, key=lambda item: (-item[0], item[1]))
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def measure(selected: list[str], relevant: list[str]) -> dict[str, int]:
|
|
57
|
+
actual, expected = set(selected), set(relevant)
|
|
58
|
+
hits = len(actual & expected)
|
|
59
|
+
return {
|
|
60
|
+
"recall_ppm": hits * 1000000 // len(expected) if expected else int(not actual) * 1000000,
|
|
61
|
+
"precision_ppm": hits * 1000000 // len(actual) if actual else int(not expected) * 1000000,
|
|
62
|
+
}
|