@hasna/mementos 0.17.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +89 -0
- package/dist/cli/commands/decisions.d.ts +5 -0
- package/dist/cli/commands/decisions.d.ts.map +1 -0
- package/dist/cli/index.js +575 -4
- package/dist/cli/register-all.d.ts.map +1 -1
- package/dist/decisions/index.d.ts +17 -0
- package/dist/decisions/index.d.ts.map +1 -0
- package/dist/decisions/openrouter.d.ts +12 -0
- package/dist/decisions/openrouter.d.ts.map +1 -0
- package/dist/decisions/settings.d.ts +11 -0
- package/dist/decisions/settings.d.ts.map +1 -0
- package/dist/decisions/types.d.ts +70 -0
- package/dist/decisions/types.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +305 -13
- package/dist/sdk/index.d.ts +1 -0
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +342 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -75,6 +75,95 @@ without a project it has no effect. Omitting it keeps an exact project match.
|
|
|
75
75
|
|
|
76
76
|
## CLI
|
|
77
77
|
|
|
78
|
+
### Optional decision assistance
|
|
79
|
+
|
|
80
|
+
Decision assistance is **off by default**. No provider account or key is needed
|
|
81
|
+
for ordinary Mementos commands. Configure and enable the features you want from
|
|
82
|
+
the CLI; there is no web setup. This adds no service-side configuration and does
|
|
83
|
+
not change ordinary `search`, context injection, or consolidation.
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
mementos decisions status --json
|
|
87
|
+
mementos decisions configure --provider openrouter --model typesafe/jev-1.13
|
|
88
|
+
mementos decisions enable --retrieval --relationships
|
|
89
|
+
# Supply OPENROUTER_API_KEY through your secret manager's process environment.
|
|
90
|
+
mementos --project my-project decisions search "release approval policy" --limit 10 --json
|
|
91
|
+
mementos decisions evaluate --input pair.json --json
|
|
92
|
+
mementos decisions disable
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
`configure` always leaves assistance disabled. `enable` permits only the selected
|
|
96
|
+
features and explicitly permits sending their text to the configured provider.
|
|
97
|
+
The key is read from `OPENROUTER_API_KEY`; it is never saved in decision settings.
|
|
98
|
+
`status` reports key presence without verifying or calling the provider. Settings
|
|
99
|
+
are versioned client preferences in the Mementos data root's `decisions.json`;
|
|
100
|
+
updates reject concurrent changes. `status`, configuration, and `evaluate` do not
|
|
101
|
+
open a memory store or require a hosted Mementos account.
|
|
102
|
+
|
|
103
|
+
`decisions search` retrieves a bounded candidate set using the existing project,
|
|
104
|
+
agent, session, scope, category, and tag filters, then optionally reranks it. Every
|
|
105
|
+
candidate is retained; ties preserve the original order. On a missing key,
|
|
106
|
+
timeout, invalid answer, oversized input, or provider failure, the original
|
|
107
|
+
ordering is returned with an explicit assessment reason. This command has no
|
|
108
|
+
pagination cursor: its receipt names `ranking_scope: "returned_candidates"` and
|
|
109
|
+
reports `has_more`. Use ordinary `search` for pagination. JSON includes compact
|
|
110
|
+
snippets and source IDs/versions, with a 128 KiB output ceiling.
|
|
111
|
+
|
|
112
|
+
`evaluate` accepts a JSON file or stdin (`--input -`). A relationship input is:
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"task": "relationship",
|
|
117
|
+
"candidates": [
|
|
118
|
+
{ "id": "a", "text": "Production deployment requires approval." },
|
|
119
|
+
{ "id": "b", "text": "Production deployment does not require approval." }
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
For relevance, use `"task": "relevance"`, a non-empty `"query"`, and a
|
|
125
|
+
`"candidates"` array of the same `{id,text}` shape. Relationship suggestions are
|
|
126
|
+
`equivalent`, `complementary`, `contradictory`, `unrelated`, or `uncertain`.
|
|
127
|
+
Evaluation is read-only: suggestions never authorize writes or replace source
|
|
128
|
+
authority, human review, or version checks. An unavailable evaluation exits 2;
|
|
129
|
+
a disabled evaluation exits 0 with an explicit `disabled` receipt.
|
|
130
|
+
|
|
131
|
+
The built-in adapter calls OpenRouter's Decisions API with a pinned model ID,
|
|
132
|
+
no automatic retries, and provider fallback disabled. Defaults bound each
|
|
133
|
+
assessment to 20 candidates, 16,000 serialized input characters, and five
|
|
134
|
+
seconds; configure these with `--max-candidates`, `--max-input-chars`, and
|
|
135
|
+
`--timeout-ms`. Input files are limited to 256 KiB and provider responses to
|
|
136
|
+
64 KiB. Only query and candidate text go to OpenRouter; arbitrary metadata and
|
|
137
|
+
candidate IDs are excluded. Known secret patterns and credential-bearing URLs
|
|
138
|
+
are redacted before transmission. Redaction is heuristic: enable this only for
|
|
139
|
+
content you are permitted to send to your chosen provider.
|
|
140
|
+
|
|
141
|
+
Jev returns judgments, not generated memories or embeddings. Its confidence is
|
|
142
|
+
distribution concentration, **not a probability of correctness**. Pinning the
|
|
143
|
+
model and criteria makes requests reproducible but does not promise deterministic
|
|
144
|
+
provider answers. Keep structural validation and authorization deterministic.
|
|
145
|
+
|
|
146
|
+
Other providers, including local implementations, can implement the public
|
|
147
|
+
`DecisionProvider` interface; no OpenRouter dependency is required by callers:
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
import { assessDecisions, rankDecisionCandidates } from "@hasna/mementos/sdk";
|
|
151
|
+
import type { DecisionProvider } from "@hasna/mementos/sdk";
|
|
152
|
+
|
|
153
|
+
// `provider` is your adapter implementing DecisionProvider.
|
|
154
|
+
async function rank(provider: DecisionProvider, query: string,
|
|
155
|
+
candidates: Array<{ id: string; text: string }>) {
|
|
156
|
+
const assessment = await assessDecisions({ task: "relevance", query, candidates }, {
|
|
157
|
+
enabled: true, retrieval: true, provider: provider.id, model: provider.model,
|
|
158
|
+
}, { provider });
|
|
159
|
+
return { assessment, candidates: rankDecisionCandidates(candidates, assessment) };
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Knowledge consumers can reuse this contract to assess already authorized
|
|
164
|
+
retrieval candidates or flag potentially conflicting passages. Source citations,
|
|
165
|
+
review state, and guarded publication remain the consumer's responsibility.
|
|
166
|
+
|
|
78
167
|
```bash
|
|
79
168
|
mementos --help
|
|
80
169
|
mementos <command> --help
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import type { MemorySearchResult } from "../../types/index.js";
|
|
3
|
+
export declare function decisionSearchResult(result: MemorySearchResult): Record<string, unknown>;
|
|
4
|
+
export declare function registerDecisionCommands(program: Command): void;
|
|
5
|
+
//# sourceMappingURL=decisions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decisions.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/decisions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWzC,OAAO,KAAK,EAA+B,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAI5F,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAaxF;AAsBD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwI/D"}
|