dsh-mnemon 0.5.38 → 0.5.40

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.
@@ -325,11 +325,29 @@ function normalizeViewSpec(value, strategy, facts, budget) {
325
325
  ]) if (input.reminders[key] !== void 0) guidance.reminders[key] = requiredText(input.reminders[key], "Strategy reminder " + key, 16384);
326
326
  }
327
327
  }
328
+ const diagnostics = value.diagnostics === void 0 ? void 0 : normalizeSpecDiagnostics(value.diagnostics);
328
329
  return deepFreeze({
329
330
  strategyTypeId: value.strategyTypeId,
330
331
  sources: normalizedSources,
331
332
  explanation: requiredText(value.explanation, "memory ViewSpec explanation", 4e3),
332
- ...guidance === void 0 ? {} : { guidance }
333
+ ...guidance === void 0 ? {} : { guidance },
334
+ ...diagnostics === void 0 ? {} : { diagnostics }
335
+ });
336
+ }
337
+ const MAX_SPEC_DIAGNOSTICS = 32;
338
+ function normalizeSpecDiagnostics(value) {
339
+ if (!Array.isArray(value)) throw new Error("memory ViewSpec diagnostics must be an array");
340
+ if (value.length > MAX_SPEC_DIAGNOSTICS) throw new Error(`memory ViewSpec diagnostics must be at most ${MAX_SPEC_DIAGNOSTICS} entries`);
341
+ return value.map((diagnostic) => {
342
+ const input = jsonClone(diagnostic, "memory ViewSpec diagnostic");
343
+ if (input === null || typeof input !== "object" || Array.isArray(input)) throw new Error("memory ViewSpec diagnostic must be an object");
344
+ const entry = input;
345
+ const contributionInstanceKey = entry.contributionInstanceKey === void 0 ? void 0 : requiredText(entry.contributionInstanceKey, "memory ViewSpec diagnostic contributionInstanceKey", 300);
346
+ return deepFreeze({
347
+ code: id(entry.code, "memory ViewSpec diagnostic code"),
348
+ message: requiredText(entry.message, "memory ViewSpec diagnostic message", 1e3),
349
+ ...contributionInstanceKey === void 0 ? {} : { contributionInstanceKey }
350
+ });
333
351
  });
334
352
  }
335
353
  function normalizeContribution(source, spec, facts, value) {
@@ -483,6 +501,7 @@ var MemoryCompositionGeneration = class {
483
501
  now;
484
502
  routeCalls = /* @__PURE__ */ new WeakMap();
485
503
  strategyTurns = /* @__PURE__ */ new WeakMap();
504
+ sourceContexts = /* @__PURE__ */ new WeakMap();
486
505
  sourceTimeoutMs;
487
506
  disposed = false;
488
507
  constructor(snapshotValue, options = {}) {
@@ -702,6 +721,7 @@ var MemoryCompositionGeneration = class {
702
721
  mode: modes.size === 1 ? [...modes][0] : "mixed",
703
722
  sourceRevisions
704
723
  };
724
+ const allDiagnostics = [...diagnostics, ...spec.diagnostics ?? []];
705
725
  const body = {
706
726
  runtimeGeneration: this.id,
707
727
  strategyInstanceKey: this.strategy.instanceKey,
@@ -719,7 +739,7 @@ var MemoryCompositionGeneration = class {
719
739
  consistency,
720
740
  explanation: spec.explanation,
721
741
  ...spec.guidance === void 0 ? {} : { guidance: spec.guidance },
722
- ...diagnostics.length === 0 ? {} : { diagnostics: diagnostics.sort((a, b) => (a.contributionInstanceKey ?? "").localeCompare(b.contributionInstanceKey ?? "") || a.code.localeCompare(b.code)) }
742
+ ...allDiagnostics.length === 0 ? {} : { diagnostics: allDiagnostics.sort((a, b) => (a.contributionInstanceKey ?? "").localeCompare(b.contributionInstanceKey ?? "") || a.code.localeCompare(b.code)) }
723
743
  };
724
744
  const viewDigest = digest(body);
725
745
  return deepFreeze({
@@ -873,10 +893,7 @@ var MemoryCompositionGeneration = class {
873
893
  if (calls >= route.maxCalls) throw new Error(`memory View Route call budget is exhausted: ${route.id}`);
874
894
  ledger.set(counter, calls + 1);
875
895
  return normalizeEvidence(await source.runtime.query({
876
- view: deepFreeze({
877
- id: view.id,
878
- scope: view.scope
879
- }),
896
+ view: this.sourceView(view, route.sourceInstanceKey, execution),
880
897
  route: selectedRoute,
881
898
  grant,
882
899
  input: jsonClone(selectedInput, "memory Route input"),
@@ -901,7 +918,24 @@ var MemoryCompositionGeneration = class {
901
918
  active = false;
902
919
  }
903
920
  }
904
- async executeAction(view, offerId, input, authorize, signal) {
921
+ sourceView(view, sourceInstanceKey, execution) {
922
+ let contexts = this.sourceContexts.get(execution);
923
+ if (contexts === void 0) {
924
+ contexts = /* @__PURE__ */ new Map();
925
+ this.sourceContexts.set(execution, contexts);
926
+ }
927
+ const key = `${view.id}\u0000${sourceInstanceKey}`;
928
+ let context = contexts.get(key);
929
+ if (context === void 0) {
930
+ context = deepFreeze({
931
+ id: view.id,
932
+ scope: view.scope
933
+ });
934
+ contexts.set(key, context);
935
+ }
936
+ return context;
937
+ }
938
+ async executeAction(view, offerId, input, authorize, signal, execution = view) {
905
939
  this.assertOpen();
906
940
  if (view.runtimeGeneration !== this.id) throw new Error("memory View belongs to a different runtime generation");
907
941
  const offer = view.actionOffers.find((candidate) => candidate.id === offerId);
@@ -913,10 +947,7 @@ var MemoryCompositionGeneration = class {
913
947
  signal?.throwIfAborted();
914
948
  const grant = view.readGrants.find((candidate) => candidate.sourceInstanceKey === offer.sourceInstanceKey);
915
949
  const receipt = await source.runtime.mutate({
916
- view: deepFreeze({
917
- id: view.id,
918
- scope: view.scope
919
- }),
950
+ view: this.sourceView(view, offer.sourceInstanceKey, execution),
920
951
  offer,
921
952
  ...grant === void 0 ? {} : { grant },
922
953
  input: jsonClone(input, "memory Action input"),
@@ -951,6 +982,7 @@ var MemoryCompositionGeneration = class {
951
982
  this.disposed = true;
952
983
  this.routeCalls = /* @__PURE__ */ new WeakMap();
953
984
  this.strategyTurns = /* @__PURE__ */ new WeakMap();
985
+ this.sourceContexts = /* @__PURE__ */ new WeakMap();
954
986
  const failures = [];
955
987
  for (const source of [...this.sources.values()].reverse()) try {
956
988
  await source.runtime.dispose?.();
@@ -14,12 +14,12 @@ var dependencies = {
14
14
  "dsh-mnemon-provider-openviking": "0.5.10",
15
15
  "dsh-mnemon-provider-retaindb": "0.5.6",
16
16
  "dsh-mnemon-provider-supermemory": "0.5.5",
17
- "dsh-mnemon-source-documents": "0.5.12",
17
+ "dsh-mnemon-source-documents": "0.5.13",
18
18
  "dsh-mnemon-source-memory-spaces": "0.5.25",
19
19
  "dsh-mnemon-source-runtime": "0.5.17",
20
- "dsh-mnemon-source-skills": "0.5.5",
20
+ "dsh-mnemon-source-skills": "0.5.7",
21
21
  "dsh-mnemon-strategy-auto-capture": "0.5.5",
22
- "dsh-mnemon-strategy-default-three-tier": "0.5.11",
22
+ "dsh-mnemon-strategy-default-three-tier": "0.5.12",
23
23
  "dsh-mnemon-strategy-general": "0.5.1",
24
24
  "dsh-mnemon-strategy-light-context": "0.5.6",
25
25
  "dsh-mnemon-strategy-scoped": "0.5.5",
package/lib/starter.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as prepareStarterResolution } from "./starter-resolution-XVFzvnV0.js";
1
+ import { t as prepareStarterResolution } from "./starter-resolution-C5nNk-cs.js";
2
2
  //#region src/starter.ts
3
3
  const name = "dsh-mnemon-starter";
4
4
  const provide = ["mnemonStarterReady"];
package/lib/testing.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as provideMemoryRuntime } from "./runtime-0u6dOiF9.js";
1
+ import { t as provideMemoryRuntime } from "./runtime-DmL0It3P.js";
2
2
  import { DEFAULT_MEMORY_VIEW_BUDGET } from "./contracts.js";
3
3
  import { c as jsonClone } from "./definitions-DU7MLBhu.js";
4
4
  import { Context } from "@deepseek-ai/cordis";
@@ -129,6 +129,10 @@ export declare const zh: {
129
129
  'status.title': string;
130
130
  'status.description': string;
131
131
  'status.nominal': string;
132
+ 'status.workflowUnavailable': string;
133
+ 'status.workflowIdleReview': string;
134
+ 'status.workflowRuntimeCapacity': string;
135
+ 'status.workflowUnsupported': string;
132
136
  'status.reviewFailed': string;
133
137
  'status.reviewFailedDetail': string;
134
138
  'status.reviewPartial': string;
@@ -421,6 +425,7 @@ export declare const zh: {
421
425
  'details.currentMain': string;
422
426
  'details.useMain': string;
423
427
  'details.back': string;
428
+ 'config.strategyWorkflowNote': string;
424
429
  'threeTier.offNote': string;
425
430
  'board.otherEnhancements': string;
426
431
  'board.more': string;
@@ -779,6 +784,11 @@ export declare const zh: {
779
784
  'skills.allowCreateHint': string;
780
785
  'skills.allowUpdate': string;
781
786
  'skills.allowUpdateHint': string;
787
+ 'skills.targetScope': string;
788
+ 'skills.targetScopeHint': string;
789
+ 'skills.targetScope.user': string;
790
+ 'skills.targetScope.project': string;
791
+ 'skills.targetScope.storage': string;
782
792
  'skills.evolutionHint': string;
783
793
  'skills.autoBacktest': string;
784
794
  'skills.autoBacktestHint': string;
@@ -230,6 +230,12 @@ export interface MemoryViewSpec {
230
230
  explanation: string;
231
231
  /** Trusted Strategy instructions, separate from quoted Source data. */
232
232
  guidance?: MemoryViewGuidance;
233
+ /**
234
+ * Why this composition deliberately left an installed Source out (#504).
235
+ * The Host validates each entry and merges it into `view.diagnostics`; a
236
+ * diagnostic explains an absence, never grants a Source projection or routes.
237
+ */
238
+ diagnostics?: MemoryCompositionDiagnostic[];
233
239
  }
234
240
  export interface MemoryViewGuidance {
235
241
  system?: string;
@@ -388,7 +394,12 @@ export interface MemorySourceRuntimeContext {
388
394
  /** Immutable, JSON-only Host/scope defaults; never business objects or clients. */
389
395
  configuration?: Readonly<Record<string, MemoryJsonValue>>;
390
396
  }
391
- /** Operation identity only; never the complete View or another Source's data. */
397
+ /**
398
+ * Operation identity only; never the complete View or another Source's data.
399
+ * The object is stable for this Source within one execution, and can key weak
400
+ * execution-local state. Independent executions never share it, even when they
401
+ * pin the exact same immutable View. Requires dsh-mnemon 0.5.40 or later.
402
+ */
392
403
  export interface MemorySourceViewContext {
393
404
  id: string;
394
405
  scope: MemoryOperationScope;
@@ -16,6 +16,11 @@ export interface MemoryCompositionStatus {
16
16
  serving: boolean;
17
17
  /** The main Strategy composing the serving composition, which a fallback can make differ from the selected one. */
18
18
  strategyTypeId?: string;
19
+ /** Strategy support only; session policy and review settings can still prevent a run. */
20
+ workflows?: {
21
+ idleReview: boolean;
22
+ runtimeCapacity: boolean;
23
+ };
19
24
  evaluation: import('../core/contracts/index.ts').MemoryCompositionEvaluationReport;
20
25
  sources: MemorySourceManagementInstance[];
21
26
  configuration: ResolvedMemoryTopologyConfig;
@@ -39,7 +44,7 @@ export declare const MNEMON_SYNC_CHANNEL = "/dsh-mnemon-sync";
39
44
  export declare const MNEMON_SYNC_TOKEN_ENV = "MNEMON_SYNC_GIT_TOKEN";
40
45
  /**
41
46
  * What a storage root publishes before anyone configures it: the branch, the
42
- * directory inside it, and the commit identity used when no author is set. They
47
+ * directory inside it, and the fallback when no author or Git identity is set. They
43
48
  * are declared with the wire constants because the settings form shows the same
44
49
  * defaults the Host would apply to an empty field.
45
50
  */
@@ -377,6 +382,8 @@ export interface ResolvedSkillsConfig {
377
382
  allowCreate: boolean;
378
383
  /** Allow reviews to suggest changes to existing skills. */
379
384
  allowUpdate: boolean;
385
+ /** Destination for new skill proposals; user preserves the pre-setting behavior. */
386
+ targetScope: 'storage' | 'user' | 'project';
380
387
  /** Backtest a draft against the current version as soon as it is written. */
381
388
  autoBacktest: boolean;
382
389
  /** The one-line skills bar under a finished turn. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mnemon",
3
- "version": "0.5.38",
3
+ "version": "0.5.40",
4
4
  "description": "Composable, view-based context for DeepSeek Harness. Pluggable sources and strategies, with layered memory and self-evolving skills out of the box.",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -164,12 +164,12 @@
164
164
  "dsh-mnemon-provider-openviking": "0.5.10",
165
165
  "dsh-mnemon-provider-retaindb": "0.5.6",
166
166
  "dsh-mnemon-provider-supermemory": "0.5.5",
167
- "dsh-mnemon-source-documents": "0.5.12",
167
+ "dsh-mnemon-source-documents": "0.5.13",
168
168
  "dsh-mnemon-source-memory-spaces": "0.5.25",
169
169
  "dsh-mnemon-source-runtime": "0.5.17",
170
- "dsh-mnemon-source-skills": "0.5.5",
170
+ "dsh-mnemon-source-skills": "0.5.7",
171
171
  "dsh-mnemon-strategy-auto-capture": "0.5.5",
172
- "dsh-mnemon-strategy-default-three-tier": "0.5.11",
172
+ "dsh-mnemon-strategy-default-three-tier": "0.5.12",
173
173
  "dsh-mnemon-strategy-general": "0.5.1",
174
174
  "dsh-mnemon-strategy-light-context": "0.5.6",
175
175
  "dsh-mnemon-strategy-scoped": "0.5.5",
@@ -188,39 +188,39 @@
188
188
  "@arethetypeswrong/cli": "^0.18.5",
189
189
  "@changesets/cli": "^2.31.1",
190
190
  "@deepseek-ai/cordis": "^4.0.5",
191
- "@deepseek-ai/dsh": "0.2.1-rc.2",
192
- "@deepseek-ai/dsh-agent": "0.2.1-rc.2",
193
- "@deepseek-ai/dsh-agent-loop": "0.2.1-rc.2",
194
- "@deepseek-ai/dsh-api-gateway": "0.2.1-rc.2",
195
- "@deepseek-ai/dsh-app-boot": "0.2.1-rc.2",
196
- "@deepseek-ai/dsh-client-connection": "0.2.1-rc.2",
197
- "@deepseek-ai/dsh-client-locale": "0.2.1-rc.2",
198
- "@deepseek-ai/dsh-client-store": "0.2.1-rc.2",
199
- "@deepseek-ai/dsh-client-ui-chat": "0.2.1-rc.2",
200
- "@deepseek-ai/dsh-client-ui-conversation": "0.2.1-rc.2",
201
- "@deepseek-ai/dsh-client-ui-layout": "0.2.1-rc.2",
202
- "@deepseek-ai/dsh-client-ui-plugin-manager": "0.2.1-rc.2",
203
- "@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.2",
204
- "@deepseek-ai/dsh-client-ui-renderer": "0.2.1-rc.2",
205
- "@deepseek-ai/dsh-client-ui-session": "0.2.1-rc.2",
206
- "@deepseek-ai/dsh-client-ui-settings": "0.2.1-rc.2",
207
- "@deepseek-ai/dsh-client-ui-sidebar": "0.2.1-rc.2",
208
- "@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.2",
209
- "@deepseek-ai/dsh-client-ui-tool": "0.2.1-rc.2",
210
- "@deepseek-ai/dsh-llm": "0.2.1-rc.2",
211
- "@deepseek-ai/dsh-session": "0.2.1-rc.2",
212
- "@deepseek-ai/dsh-session-format-v0-to-v1": "0.2.1-rc.2",
213
- "@deepseek-ai/dsh-session-persistence-jsonl": "0.2.1-rc.2",
214
- "@deepseek-ai/dsh-session-projection": "0.2.1-rc.2",
215
- "@deepseek-ai/dsh-session-query": "0.2.1-rc.2",
216
- "@deepseek-ai/dsh-subagent": "0.2.1-rc.2",
217
- "@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.1-rc.2",
218
- "@deepseek-ai/dsh-system-prompt": "0.2.1-rc.2",
219
- "@deepseek-ai/dsh-tools": "0.2.1-rc.2",
220
- "@deepseek-ai/dsh-typert-protocol": "0.2.1-rc.2",
221
- "@deepseek-ai/dsh-typert-registry": "0.2.1-rc.2",
222
- "@deepseek-ai/dsh-util-code-language": "0.2.1-rc.2",
223
- "@deepseek-ai/dsh-util-workspace-path": "0.2.1-rc.2",
191
+ "@deepseek-ai/dsh": "0.2.1-rc.5",
192
+ "@deepseek-ai/dsh-agent": "0.2.1-rc.5",
193
+ "@deepseek-ai/dsh-agent-loop": "0.2.1-rc.5",
194
+ "@deepseek-ai/dsh-api-gateway": "0.2.1-rc.5",
195
+ "@deepseek-ai/dsh-app-boot": "0.2.1-rc.5",
196
+ "@deepseek-ai/dsh-client-connection": "0.2.1-rc.5",
197
+ "@deepseek-ai/dsh-client-locale": "0.2.1-rc.5",
198
+ "@deepseek-ai/dsh-client-store": "0.2.1-rc.5",
199
+ "@deepseek-ai/dsh-client-ui-chat": "0.2.1-rc.5",
200
+ "@deepseek-ai/dsh-client-ui-conversation": "0.2.1-rc.5",
201
+ "@deepseek-ai/dsh-client-ui-layout": "0.2.1-rc.5",
202
+ "@deepseek-ai/dsh-client-ui-plugin-manager": "0.2.1-rc.5",
203
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.5",
204
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.1-rc.5",
205
+ "@deepseek-ai/dsh-client-ui-session": "0.2.1-rc.5",
206
+ "@deepseek-ai/dsh-client-ui-settings": "0.2.1-rc.5",
207
+ "@deepseek-ai/dsh-client-ui-sidebar": "0.2.1-rc.5",
208
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.5",
209
+ "@deepseek-ai/dsh-client-ui-tool": "0.2.1-rc.5",
210
+ "@deepseek-ai/dsh-llm": "0.2.1-rc.5",
211
+ "@deepseek-ai/dsh-session": "0.2.1-rc.5",
212
+ "@deepseek-ai/dsh-session-format-v0-to-v1": "0.2.1-rc.5",
213
+ "@deepseek-ai/dsh-session-persistence-jsonl": "0.2.1-rc.5",
214
+ "@deepseek-ai/dsh-session-projection": "0.2.1-rc.5",
215
+ "@deepseek-ai/dsh-session-query": "0.2.1-rc.5",
216
+ "@deepseek-ai/dsh-subagent": "0.2.1-rc.5",
217
+ "@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.1-rc.5",
218
+ "@deepseek-ai/dsh-system-prompt": "0.2.1-rc.5",
219
+ "@deepseek-ai/dsh-tools": "0.2.1-rc.5",
220
+ "@deepseek-ai/dsh-typert-protocol": "0.2.1-rc.5",
221
+ "@deepseek-ai/dsh-typert-registry": "0.2.1-rc.5",
222
+ "@deepseek-ai/dsh-util-code-language": "0.2.1-rc.5",
223
+ "@deepseek-ai/dsh-util-workspace-path": "0.2.1-rc.5",
224
224
  "@shikijs/langs": "^4.3.1",
225
225
  "@testing-library/react": "^16.3.0",
226
226
  "@types/node": "^22.0.0",