@astratra/conscience 1.4.0 → 1.5.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.fr.md CHANGED
@@ -6,7 +6,7 @@ Une mémoire documentée des décisions d'un agent IA, tenue sous un gouverneur
6
6
  déterministe. L'agent enregistre ce qu'il a décidé, pourquoi, avec quelles
7
7
  versions et ce qu'il attendait ; les résultats, les corrections humaines et les
8
8
  leçons s'y rattachent ensuite, avec leurs preuves, et rien n'est jamais écrasé
9
- en silence. Node >= 20, CommonJS, MIT.
9
+ en silence. Node >= 22, CommonJS, MIT.
10
10
 
11
11
  « Conscience » et « autoconscience » désignent des fonctions logicielles : un
12
12
  registre des décisions puis, plus tard, un moteur de réflexion. Elles
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  A documented memory of an AI agent's decisions, kept under a deterministic
6
6
  governor. The agent records what it decided, why, with which versions and what
7
7
  it expected; outcomes, human corrections and lessons are attached later, with
8
- their evidence, and nothing is ever silently overwritten. Node >= 20,
8
+ their evidence, and nothing is ever silently overwritten. Node >= 22,
9
9
  CommonJS, MIT.
10
10
 
11
11
  "Conscience" and "autoconscience" name software functions: a record of
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@astratra/conscience",
3
- "version": "1.4.0",
3
+ "version": "1.5.1",
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
- "node": ">=20"
6
+ "node": ">=22"
7
7
  },
8
8
  "main": "src/index.js",
9
9
  "types": "src/index.d.ts",
@@ -29,11 +29,11 @@
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@astratra/ai": "^1.8.0"
32
+ "@astratra/ai": "^1.8.0 || ^2.0.0"
33
33
  },
34
34
  "devDependencies": {
35
- "pg": "^8.13.1",
36
- "mongoose": "^8.24.2"
35
+ "mongoose": "^9.12.1",
36
+ "pg": "^8.13.1"
37
37
  },
38
38
  "exports": {
39
39
  ".": {
@@ -92,7 +92,7 @@ async function reviewByRoles(options = {}) {
92
92
  const items = Array.isArray(verifierAnswer.value?.evidence) ? verifierAnswer.value.evidence : Array.isArray(verifierAnswer.value) ? verifierAnswer.value : [];
93
93
  for (const item of items) {
94
94
  if (!item || !EVIDENCE_KINDS.includes(item.kind) || !isNonEmptyString(item.ref) || ownRefs.has(item.ref)) continue;
95
- let exists = false;
95
+ let exists;
96
96
  try { exists = (await options.evidenceExists({ kind: item.kind, ref: item.ref, organisationId: org })) === true; } catch (_error) { exists = false; }
97
97
  verified.set(`${item.kind}\u0000${item.ref}`, exists);
98
98
  }
@@ -227,7 +227,7 @@ function createChanges(ctx) {
227
227
  if (!state.candidate) return pick(state.stable, 'stable', 'no_candidate');
228
228
  if ((await haltState(at.organisationId)).halted) return pick(state.stable, 'stable', 'halted');
229
229
  const context = { targetingKey: input.targetingKey, attributes: input.attributes };
230
- let served = false;
230
+ let served;
231
231
  if (ctx.flags) {
232
232
  try { served = (await ctx.flags.resolveBoolean(flagKeyOf(at.organisationId, at.kind, at.id), false, context))?.value === true; } catch (_error) { served = false; }
233
233
  } else served = servesCandidate(state.rollout, seedOf(at.organisationId, at.kind, at.id, state.candidate), context);
@@ -85,7 +85,7 @@ function createGovernor(policy, options = {}) {
85
85
 
86
86
  function judge(proposal, halted) {
87
87
  const reasons = [];
88
- let touched = [];
88
+ let touched;
89
89
  if (halted) reasons.push(REASONS.HALTED);
90
90
  const target = proposal.target;
91
91
  if (!target || !isNonEmptyString(target.kind) || !isNonEmptyString(target.id) || proposal.change === null
@@ -223,7 +223,7 @@ function createToolPolicy(options = {}) {
223
223
  /* Content read from outside could carry a hidden instruction: a person looks first. */
224
224
  if ((run.untrusted || call.untrusted === true) && untrustedLevels.includes(tool.level)) return pending(TOOL_REASONS.UNTRUSTED);
225
225
  if (tool.level === TOOL_LEVELS.CONTROLLED && tool.overThreshold) {
226
- let over = false;
226
+ let over;
227
227
  // May be async (a cap read from the database). A failure or a timeout puts the call in front of a person.
228
228
  try { over = (await tool.overThreshold(input, settings, { organisationId, actor: actorOf(call.actor) })) === true; } catch (_error) { over = true; }
229
229
  if (over) return pending(TOOL_REASONS.THRESHOLD);