@astratra/conscience 1.5.1 → 1.5.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astratra/conscience",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "Documented memory of an AI agent's decisions (outcomes, corrections, lessons with evidence, self-model, lineage, erasure) under a deterministic governor with no language model: constitution, permissions, budgets, isolation, kill switch, human approval.",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -100,17 +100,23 @@ async function runReflection(options) { return evaluateOutcomes(options); }
100
100
  function createEvaluator(options) {
101
101
  return Object.freeze({ evaluate: (input) => evaluateOutcomes({ ...options, ...input, governor: options.governor, conscience: options.conscience }) });
102
102
  }
103
- module.exports = { runReflection, evaluateOutcomes, createEvaluator, AVAILABLE_FROM,
104
- wilsonInterval: statistics.wilsonInterval, honestStatistics: statistics.honestStatistics,
105
- calibratePredictions: statistics.calibratePredictions, scoreErrorCosts: statistics.scoreErrorCosts, ...signals, ...lessons };
106
103
 
107
104
  // P3 experiments (first half); append-only integration with the evaluation core.
108
105
  const { createSandbox } = require('./experiments/sandbox');
109
106
  const { replayDecisions } = require('./experiments/replay');
110
107
  const { createHoldout } = require('./experiments/holdout');
111
108
  const { proposeExperiment, runExperiment } = require('./experiments/laboratory');
112
- Object.assign(module.exports, { createSandbox, replayDecisions, createHoldout, proposeExperiment, runExperiment });
113
- /* P3 · vigilance (2/2): drift, follow-ups, abstention, night adversary, multi-role review, lessons turned into tests. */
114
- Object.assign(module.exports, require('./vigilance'));
115
- /* P4 · shadow mode: a candidate approved by humans processes real requests in silence, in the sandbox, and is compared with the stable strategy. */
116
- Object.assign(module.exports, require('./shadow'));
109
+
110
+ // Des noms seuls et des « ...require() » dans l'objet exporté : Node les lit sans exécuter le fichier, pour les imports
111
+ // nommés d'un module ES. L'ordre est celui d'avant (les ajouts successifs) : P2, P3 expériences, vigilance, ombre.
112
+ const { wilsonInterval, honestStatistics, calibratePredictions, scoreErrorCosts } = statistics;
113
+ module.exports = {
114
+ runReflection, evaluateOutcomes, createEvaluator, AVAILABLE_FROM,
115
+ wilsonInterval, honestStatistics, calibratePredictions, scoreErrorCosts,
116
+ ...require('./signals'), ...require('./lessons'),
117
+ createSandbox, replayDecisions, createHoldout, proposeExperiment, runExperiment,
118
+ /* P3 · vigilance (2/2): drift, follow-ups, abstention, night adversary, multi-role review, lessons turned into tests. */
119
+ ...require('./vigilance'),
120
+ /* P4 · shadow mode: a candidate approved by humans processes real requests in silence, in the sandbox, and is compared with the stable strategy. */
121
+ ...require('./shadow')
122
+ };
@@ -4,8 +4,12 @@ const runner = require('./runner');
4
4
  const store = require('./store');
5
5
  const report = require('./report');
6
6
 
7
+ // Des noms seuls dans l'objet exporté : Node les lit sans exécuter le fichier, pour les imports nommés d'un module ES.
8
+ const { createShadowRunner } = runner;
9
+ const SHADOW_CONCLUSIONS = report.CONCLUSIONS;
10
+ const { createMemoryShadowStore, createPostgresShadowStore, postgresShadowSchema, shadowEraser } = store;
7
11
  module.exports = {
8
- createShadowRunner: runner.createShadowRunner, SHADOW_CONCLUSIONS: report.CONCLUSIONS,
9
- createMemoryShadowStore: store.createMemoryShadowStore, createPostgresShadowStore: store.createPostgresShadowStore,
10
- postgresShadowSchema: store.postgresShadowSchema, shadowEraser: store.shadowEraser
12
+ createShadowRunner, SHADOW_CONCLUSIONS,
13
+ createMemoryShadowStore, createPostgresShadowStore,
14
+ postgresShadowSchema, shadowEraser
11
15
  };
@@ -9,15 +9,25 @@ const lessonTests = require('./lessonTests');
9
9
  const library = require('./library');
10
10
  const store = require('./store');
11
11
 
12
+ // Des noms seuls dans l'objet exporté : Node les lit sans exécuter le fichier, pour les imports nommés d'un module ES.
13
+ const { detectDrift, snapshotWindow, populationStabilityIndex, differenceInterval, DRIFT_RECOMMENDATIONS } = drift;
14
+ const { createFollowUps, followUpEraser, FOLLOW_UP_STATUSES } = followups;
15
+ const { abstentionPolicy, shouldAbstain, ABSTENTION_DEFAULT_THRESHOLD } = abstention;
16
+ const { generateAdversarialCases, ADVERSARIAL_CATEGORIES } = adversary;
17
+ const { reviewByRoles, REVIEW_ROLES, REVIEW_SCOPES } = roles;
18
+ const { lessonToScenario } = lessonTests;
19
+ const { createScenarioLibrary, SCENARIO_CATEGORIES, CANDIDATE_STATUSES } = library;
20
+ const scenarioToTestkit = library.toScenario;
21
+ const { createMemoryVigilanceStore, createPostgresVigilanceStore, postgresVigilanceSchema } = store;
12
22
  module.exports = {
13
- detectDrift: drift.detectDrift, snapshotWindow: drift.snapshotWindow, populationStabilityIndex: drift.populationStabilityIndex,
14
- differenceInterval: drift.differenceInterval, DRIFT_RECOMMENDATIONS: drift.DRIFT_RECOMMENDATIONS,
15
- createFollowUps: followups.createFollowUps, followUpEraser: followups.followUpEraser, FOLLOW_UP_STATUSES: followups.FOLLOW_UP_STATUSES,
16
- abstentionPolicy: abstention.abstentionPolicy, shouldAbstain: abstention.shouldAbstain, ABSTENTION_DEFAULT_THRESHOLD: abstention.ABSTENTION_DEFAULT_THRESHOLD,
17
- generateAdversarialCases: adversary.generateAdversarialCases, ADVERSARIAL_CATEGORIES: adversary.ADVERSARIAL_CATEGORIES,
18
- reviewByRoles: roles.reviewByRoles, REVIEW_ROLES: roles.REVIEW_ROLES, REVIEW_SCOPES: roles.REVIEW_SCOPES,
19
- lessonToScenario: lessonTests.lessonToScenario,
20
- createScenarioLibrary: library.createScenarioLibrary, scenarioToTestkit: library.toScenario,
21
- SCENARIO_CATEGORIES: library.SCENARIO_CATEGORIES, CANDIDATE_STATUSES: library.CANDIDATE_STATUSES,
22
- createMemoryVigilanceStore: store.createMemoryVigilanceStore, createPostgresVigilanceStore: store.createPostgresVigilanceStore, postgresVigilanceSchema: store.postgresVigilanceSchema
23
+ detectDrift, snapshotWindow, populationStabilityIndex,
24
+ differenceInterval, DRIFT_RECOMMENDATIONS,
25
+ createFollowUps, followUpEraser, FOLLOW_UP_STATUSES,
26
+ abstentionPolicy, shouldAbstain, ABSTENTION_DEFAULT_THRESHOLD,
27
+ generateAdversarialCases, ADVERSARIAL_CATEGORIES,
28
+ reviewByRoles, REVIEW_ROLES, REVIEW_SCOPES,
29
+ lessonToScenario,
30
+ createScenarioLibrary, scenarioToTestkit,
31
+ SCENARIO_CATEGORIES, CANDIDATE_STATUSES,
32
+ createMemoryVigilanceStore, createPostgresVigilanceStore, postgresVigilanceSchema
23
33
  };
package/src/index.js CHANGED
@@ -15,12 +15,16 @@ const { GovernorError } = require('./governor/util');
15
15
 
16
16
  const { createMongoConscienceStore, mongoConscienceIndexes } = require('./mongo');
17
17
 
18
+ // Des noms seuls dans l'objet exporté : Node les lit sans exécuter le fichier, pour les imports nommés d'un module ES.
19
+ const { OUTCOME_STATUSES, CORRECTION_CLASSES, LESSON_STATUSES, EVIDENCE_DEGREES, EVIDENCE_KINDS, PROVENANCE_KINDS } = records;
20
+ const RECORD_KINDS = records.KINDS;
21
+
18
22
  module.exports = {
19
23
  createMongoConscienceStore, mongoConscienceIndexes,
20
24
  createConscience, createMemoryConscienceStore, createPostgresConscienceStore, postgresConscienceSchema,
21
25
  frameStoredText, frameRecordsForModel, wordDelta, matchesFilter,
22
26
  ConscienceError, GovernorError, assertGovernorReady, isGovernor,
23
- RECORD_KINDS: records.KINDS, OUTCOME_STATUSES: records.OUTCOME_STATUSES, CORRECTION_CLASSES: records.CORRECTION_CLASSES,
24
- LESSON_STATUSES: records.LESSON_STATUSES, EVIDENCE_DEGREES: records.EVIDENCE_DEGREES, EVIDENCE_KINDS: records.EVIDENCE_KINDS,
25
- PROVENANCE_KINDS: records.PROVENANCE_KINDS, ERASURE_MODES
27
+ RECORD_KINDS, OUTCOME_STATUSES, CORRECTION_CLASSES,
28
+ LESSON_STATUSES, EVIDENCE_DEGREES, EVIDENCE_KINDS,
29
+ PROVENANCE_KINDS, ERASURE_MODES
26
30
  };
package/src/records.js CHANGED
@@ -214,7 +214,8 @@ function selfModel(input) {
214
214
  };
215
215
  }
216
216
 
217
+ const normalize = { decision, prediction, outcome, correction, lesson, self_model: selfModel };
217
218
  module.exports = {
218
219
  KINDS, OUTCOME_STATUSES, CORRECTION_CLASSES, LESSON_STATUSES, EVIDENCE_DEGREES, EVIDENCE_KINDS, PROVENANCE_KINDS,
219
- scopeOf, normalize: { decision, prediction, outcome, correction, lesson, self_model: selfModel }
220
+ scopeOf, normalize
220
221
  };