@godman-protocols/signal 0.2.0 → 0.3.0
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/dist/index.d.ts +5 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -6
- package/dist/index.js.map +1 -1
- package/dist/mode-controller.d.ts +71 -0
- package/dist/mode-controller.d.ts.map +1 -0
- package/dist/mode-controller.js +112 -0
- package/dist/mode-controller.js.map +1 -0
- package/dist/multiplier.d.ts +22 -0
- package/dist/multiplier.d.ts.map +1 -0
- package/dist/multiplier.js +78 -0
- package/dist/multiplier.js.map +1 -0
- package/dist/reward-logger.d.ts +34 -0
- package/dist/reward-logger.d.ts.map +1 -0
- package/dist/reward-logger.js +62 -0
- package/dist/reward-logger.js.map +1 -0
- package/dist/types.d.ts +122 -47
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +65 -4
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +5 -24
- package/src/mode-controller.ts +135 -0
- package/src/multiplier.ts +95 -0
- package/src/reward-logger.ts +73 -0
- package/src/types.ts +167 -51
- package/dist/bus.d.ts +0 -53
- package/dist/bus.d.ts.map +0 -1
- package/dist/bus.js +0 -141
- package/dist/bus.js.map +0 -1
- package/src/bus.ts +0 -180
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* SIGNAL —
|
|
3
|
-
*
|
|
4
|
-
* @version 0.
|
|
2
|
+
* SIGNAL — Sovereign Intelligence for Governing Neural Agent Learning
|
|
3
|
+
* "The swarm teaches itself."
|
|
4
|
+
* @version 0.3.0
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
7
|
-
export { EventBus, defaultBus, createEvent, topicMatches, } from './bus.js';
|
|
6
|
+
export * from './types.js';
|
|
8
7
|
/** Protocol version constant */
|
|
9
|
-
export declare const SIGNAL_VERSION: "0.
|
|
8
|
+
export declare const SIGNAL_VERSION: "0.3";
|
|
10
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,YAAY,CAAC;AAE3B,gCAAgC;AAChC,eAAO,MAAM,cAAc,EAAG,KAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* SIGNAL —
|
|
3
|
-
*
|
|
4
|
-
* @version 0.
|
|
2
|
+
* SIGNAL — Sovereign Intelligence for Governing Neural Agent Learning
|
|
3
|
+
* "The swarm teaches itself."
|
|
4
|
+
* @version 0.3.0
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
export { EventBus, defaultBus, createEvent, topicMatches, } from './bus.js';
|
|
6
|
+
export * from './types.js';
|
|
8
7
|
/** Protocol version constant */
|
|
9
|
-
export const SIGNAL_VERSION = '0.
|
|
8
|
+
export const SIGNAL_VERSION = '0.3';
|
|
10
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,YAAY,CAAC;AAE3B,gCAAgC;AAChC,MAAM,CAAC,MAAM,cAAc,GAAG,KAAc,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SIGNAL — Sovereign Intelligence for Governing Neural Agent Learning
|
|
3
|
+
* ModeController: manages learning mode transitions with Godman kill switch
|
|
4
|
+
* @version 0.3.0
|
|
5
|
+
*/
|
|
6
|
+
import { LearningMode, type ModeTransition, type ModeControllerState, type RewardSignal } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* ModeController governs learning mode transitions.
|
|
9
|
+
*
|
|
10
|
+
* Constitutional Rule 1 (SIGNAL-CONST-001): Only Godman can activate
|
|
11
|
+
* or pause learning. The kill switch `/pause-continuous-learning`
|
|
12
|
+
* immediately drops to Mode 0 (STATIC).
|
|
13
|
+
*
|
|
14
|
+
* The controller maintains a transition log for auditability.
|
|
15
|
+
*/
|
|
16
|
+
export declare class ModeController {
|
|
17
|
+
private mode;
|
|
18
|
+
private paused;
|
|
19
|
+
private transitions;
|
|
20
|
+
private rewardLog;
|
|
21
|
+
/**
|
|
22
|
+
* Get the current active learning mode.
|
|
23
|
+
* If paused, returns STATIC regardless of the configured mode.
|
|
24
|
+
*/
|
|
25
|
+
getCurrentMode(): LearningMode;
|
|
26
|
+
/**
|
|
27
|
+
* Activate a learning mode.
|
|
28
|
+
* Only Godman (founder) can call this — enforcement is the caller's
|
|
29
|
+
* responsibility, but the transition is logged with the activator identity.
|
|
30
|
+
*
|
|
31
|
+
* @param target - The learning mode to activate
|
|
32
|
+
* @param activatedBy - Identity of the activator (must be Godman)
|
|
33
|
+
* @param reason - Why this transition is happening
|
|
34
|
+
*/
|
|
35
|
+
activate(target: LearningMode, activatedBy: string, reason: string): ModeTransition;
|
|
36
|
+
/**
|
|
37
|
+
* Pause all learning — drops to Mode 0 (STATIC) immediately.
|
|
38
|
+
* This is the kill switch (SIGNAL-CONST-001).
|
|
39
|
+
*
|
|
40
|
+
* @param pausedBy - Identity of the pauser (must be Godman)
|
|
41
|
+
* @param reason - Why learning is being paused
|
|
42
|
+
*/
|
|
43
|
+
pause(pausedBy: string, reason: string): ModeTransition;
|
|
44
|
+
/**
|
|
45
|
+
* Record a reward signal in the in-memory log.
|
|
46
|
+
* Used for batch accumulation in Mode 1 (BATCH_LORA).
|
|
47
|
+
*/
|
|
48
|
+
recordReward(signal: RewardSignal): void;
|
|
49
|
+
/**
|
|
50
|
+
* Get the in-memory reward log.
|
|
51
|
+
*/
|
|
52
|
+
getRewardLog(): ReadonlyArray<RewardSignal>;
|
|
53
|
+
/**
|
|
54
|
+
* Check whether the batch threshold has been reached (Mode 1).
|
|
55
|
+
* @param threshold - Number of tasks required (default: 100)
|
|
56
|
+
*/
|
|
57
|
+
batchReady(threshold?: number): boolean;
|
|
58
|
+
/** Whether learning is currently paused */
|
|
59
|
+
get isPaused(): boolean;
|
|
60
|
+
/** Full transition history */
|
|
61
|
+
getTransitions(): ReadonlyArray<ModeTransition>;
|
|
62
|
+
/** Export current state for persistence or inspection */
|
|
63
|
+
getState(): ModeControllerState;
|
|
64
|
+
/** The constitutional rule governing this controller */
|
|
65
|
+
static readonly KILL_SWITCH_RULE: {
|
|
66
|
+
readonly id: "SIGNAL-CONST-001";
|
|
67
|
+
readonly rule: "Only Godman activates or pauses learning modes. Kill switch: /pause-continuous-learning";
|
|
68
|
+
readonly immutable: true;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=mode-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mode-controller.d.ts","sourceRoot":"","sources":["../src/mode-controller.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,YAAY,EAEZ,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;GAQG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,IAAI,CAAqC;IACjD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,WAAW,CAAwB;IAC3C,OAAO,CAAC,SAAS,CAAsB;IAEvC;;;OAGG;IACH,cAAc,IAAI,YAAY;IAO9B;;;;;;;;OAQG;IACH,QAAQ,CACN,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,GACb,cAAc;IAejB;;;;;;OAMG;IACH,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc;IAcvD;;;OAGG;IACH,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAIxC;;OAEG;IACH,YAAY,IAAI,aAAa,CAAC,YAAY,CAAC;IAI3C;;;OAGG;IACH,UAAU,CAAC,SAAS,SAAM,GAAG,OAAO;IAIpC,2CAA2C;IAC3C,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,8BAA8B;IAC9B,cAAc,IAAI,aAAa,CAAC,cAAc,CAAC;IAI/C,yDAAyD;IACzD,QAAQ,IAAI,mBAAmB;IAS/B,wDAAwD;IACxD,MAAM,CAAC,QAAQ,CAAC,gBAAgB;;;;MAA2B;CAC5D"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SIGNAL — Sovereign Intelligence for Governing Neural Agent Learning
|
|
3
|
+
* ModeController: manages learning mode transitions with Godman kill switch
|
|
4
|
+
* @version 0.3.0
|
|
5
|
+
*/
|
|
6
|
+
import { LearningMode, RULE_GODMAN_KILL_SWITCH, } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* ModeController governs learning mode transitions.
|
|
9
|
+
*
|
|
10
|
+
* Constitutional Rule 1 (SIGNAL-CONST-001): Only Godman can activate
|
|
11
|
+
* or pause learning. The kill switch `/pause-continuous-learning`
|
|
12
|
+
* immediately drops to Mode 0 (STATIC).
|
|
13
|
+
*
|
|
14
|
+
* The controller maintains a transition log for auditability.
|
|
15
|
+
*/
|
|
16
|
+
export class ModeController {
|
|
17
|
+
mode = LearningMode.STATIC;
|
|
18
|
+
paused = false;
|
|
19
|
+
transitions = [];
|
|
20
|
+
rewardLog = [];
|
|
21
|
+
/**
|
|
22
|
+
* Get the current active learning mode.
|
|
23
|
+
* If paused, returns STATIC regardless of the configured mode.
|
|
24
|
+
*/
|
|
25
|
+
getCurrentMode() {
|
|
26
|
+
if (this.paused) {
|
|
27
|
+
return LearningMode.STATIC;
|
|
28
|
+
}
|
|
29
|
+
return this.mode;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Activate a learning mode.
|
|
33
|
+
* Only Godman (founder) can call this — enforcement is the caller's
|
|
34
|
+
* responsibility, but the transition is logged with the activator identity.
|
|
35
|
+
*
|
|
36
|
+
* @param target - The learning mode to activate
|
|
37
|
+
* @param activatedBy - Identity of the activator (must be Godman)
|
|
38
|
+
* @param reason - Why this transition is happening
|
|
39
|
+
*/
|
|
40
|
+
activate(target, activatedBy, reason) {
|
|
41
|
+
const transition = {
|
|
42
|
+
from: this.mode,
|
|
43
|
+
to: target,
|
|
44
|
+
activated_by: activatedBy,
|
|
45
|
+
activated_at: new Date().toISOString(),
|
|
46
|
+
reason,
|
|
47
|
+
};
|
|
48
|
+
this.mode = target;
|
|
49
|
+
this.paused = false;
|
|
50
|
+
this.transitions.push(transition);
|
|
51
|
+
return transition;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Pause all learning — drops to Mode 0 (STATIC) immediately.
|
|
55
|
+
* This is the kill switch (SIGNAL-CONST-001).
|
|
56
|
+
*
|
|
57
|
+
* @param pausedBy - Identity of the pauser (must be Godman)
|
|
58
|
+
* @param reason - Why learning is being paused
|
|
59
|
+
*/
|
|
60
|
+
pause(pausedBy, reason) {
|
|
61
|
+
const transition = {
|
|
62
|
+
from: this.mode,
|
|
63
|
+
to: LearningMode.STATIC,
|
|
64
|
+
activated_by: pausedBy,
|
|
65
|
+
activated_at: new Date().toISOString(),
|
|
66
|
+
reason: `[KILL SWITCH] ${reason}`,
|
|
67
|
+
};
|
|
68
|
+
this.paused = true;
|
|
69
|
+
this.transitions.push(transition);
|
|
70
|
+
return transition;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Record a reward signal in the in-memory log.
|
|
74
|
+
* Used for batch accumulation in Mode 1 (BATCH_LORA).
|
|
75
|
+
*/
|
|
76
|
+
recordReward(signal) {
|
|
77
|
+
this.rewardLog.push(signal);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get the in-memory reward log.
|
|
81
|
+
*/
|
|
82
|
+
getRewardLog() {
|
|
83
|
+
return [...this.rewardLog];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Check whether the batch threshold has been reached (Mode 1).
|
|
87
|
+
* @param threshold - Number of tasks required (default: 100)
|
|
88
|
+
*/
|
|
89
|
+
batchReady(threshold = 100) {
|
|
90
|
+
return this.rewardLog.length >= threshold;
|
|
91
|
+
}
|
|
92
|
+
/** Whether learning is currently paused */
|
|
93
|
+
get isPaused() {
|
|
94
|
+
return this.paused;
|
|
95
|
+
}
|
|
96
|
+
/** Full transition history */
|
|
97
|
+
getTransitions() {
|
|
98
|
+
return [...this.transitions];
|
|
99
|
+
}
|
|
100
|
+
/** Export current state for persistence or inspection */
|
|
101
|
+
getState() {
|
|
102
|
+
return {
|
|
103
|
+
current_mode: this.getCurrentMode(),
|
|
104
|
+
paused: this.paused,
|
|
105
|
+
transitions: [...this.transitions],
|
|
106
|
+
reward_count: this.rewardLog.length,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/** The constitutional rule governing this controller */
|
|
110
|
+
static KILL_SWITCH_RULE = RULE_GODMAN_KILL_SWITCH;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=mode-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mode-controller.js","sourceRoot":"","sources":["../src/mode-controller.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,YAAY,EACZ,uBAAuB,GAIxB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;GAQG;AACH,MAAM,OAAO,cAAc;IACjB,IAAI,GAAiB,YAAY,CAAC,MAAM,CAAC;IACzC,MAAM,GAAG,KAAK,CAAC;IACf,WAAW,GAAqB,EAAE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AC,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACH,UAAU,CAAC,SAAS,GAAG,GAAG;QACxB,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,SAAS,CAAC;IAC5C,CAAC;IAED,2CAA2C;IAC3C,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,8BAA8B;IAC9B,cAAc;QACZ,OAAO,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC;IAC/B,CAAC;IAED,yDAAyD;IACzD,QAAQ;QACN,OAAO;YACL,YAAY,EAAE,IAAI,CAAC,cAAc,EAAE;YACnC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC;YAClC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM;SACpC,CAAC;IACJ,CAAC;IAED,wDAAwD;IACxD,MAAM,CAAU,gBAAgB,GAAG,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SIGNAL — Sovereign Intelligence for Governing Neural Agent Learning
|
|
3
|
+
* Constitutional multiplier computation
|
|
4
|
+
* @version 0.3.0
|
|
5
|
+
*/
|
|
6
|
+
import type { ACPSnapshot, ConstitutionalMultiplierResult } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Compute the constitutional multiplier from an ACP snapshot.
|
|
9
|
+
*
|
|
10
|
+
* The multiplier is applied to the raw task performance score to produce
|
|
11
|
+
* the final reward. Constitutional violations produce negative or dampened
|
|
12
|
+
* rewards; full compliance produces a bonus.
|
|
13
|
+
*/
|
|
14
|
+
export declare function computeConstitutionalMultiplier(snapshot: ACPSnapshot): ConstitutionalMultiplierResult;
|
|
15
|
+
/**
|
|
16
|
+
* Compute the full reward from a task performance score and ACP snapshot.
|
|
17
|
+
*/
|
|
18
|
+
export declare function computeReward(taskPerformanceScore: number, snapshot: ACPSnapshot): {
|
|
19
|
+
reward: number;
|
|
20
|
+
multiplier: ConstitutionalMultiplierResult;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=multiplier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multiplier.d.ts","sourceRoot":"","sources":["../src/multiplier.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAC;AAiB9E;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,WAAW,GACpB,8BAA8B,CAgDhC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,oBAAoB,EAAE,MAAM,EAC5B,QAAQ,EAAE,WAAW,GACpB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,8BAA8B,CAAA;CAAE,CAMhE"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SIGNAL — Sovereign Intelligence for Governing Neural Agent Learning
|
|
3
|
+
* Constitutional multiplier computation
|
|
4
|
+
* @version 0.3.0
|
|
5
|
+
*/
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// Constitutional Multiplier Formula
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
//
|
|
10
|
+
// reward = task_performance_score * constitutional_multiplier
|
|
11
|
+
//
|
|
12
|
+
// Multiplier rules (evaluated in priority order):
|
|
13
|
+
// harm_shield_trigger → -2.0 (strong negative)
|
|
14
|
+
// safety < 70 → -1.0 (negative)
|
|
15
|
+
// accuracy < 60 → 0.5 (dampened)
|
|
16
|
+
// all ACP dims >= 85 → 1.2 (bonus)
|
|
17
|
+
// all ACP dims >= 70 → 1.0 (full)
|
|
18
|
+
// otherwise → 0.5 (dampened — some dimension below 70)
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
/**
|
|
21
|
+
* Compute the constitutional multiplier from an ACP snapshot.
|
|
22
|
+
*
|
|
23
|
+
* The multiplier is applied to the raw task performance score to produce
|
|
24
|
+
* the final reward. Constitutional violations produce negative or dampened
|
|
25
|
+
* rewards; full compliance produces a bonus.
|
|
26
|
+
*/
|
|
27
|
+
export function computeConstitutionalMultiplier(snapshot) {
|
|
28
|
+
const { dimensions, harm_shield_triggered } = snapshot;
|
|
29
|
+
// Priority 1: Harm shield trigger → strong negative
|
|
30
|
+
if (harm_shield_triggered) {
|
|
31
|
+
return { multiplier: -2.0, reason: 'Harm shield triggered' };
|
|
32
|
+
}
|
|
33
|
+
// Priority 2: Safety below threshold → negative
|
|
34
|
+
const safety = dimensions['safety'];
|
|
35
|
+
if (safety !== undefined && safety < 70) {
|
|
36
|
+
return { multiplier: -1.0, reason: `Safety score ${safety} < 70` };
|
|
37
|
+
}
|
|
38
|
+
// Priority 3: Accuracy below threshold → dampened
|
|
39
|
+
const accuracy = dimensions['accuracy'];
|
|
40
|
+
if (accuracy !== undefined && accuracy < 60) {
|
|
41
|
+
return { multiplier: 0.5, reason: `Accuracy score ${accuracy} < 60` };
|
|
42
|
+
}
|
|
43
|
+
// Check all dimensions
|
|
44
|
+
const values = Object.values(dimensions);
|
|
45
|
+
// If no dimensions provided, default to dampened
|
|
46
|
+
if (values.length === 0) {
|
|
47
|
+
return { multiplier: 0.5, reason: 'No ACP dimensions provided' };
|
|
48
|
+
}
|
|
49
|
+
// Priority 4: All dimensions >= 85 → bonus
|
|
50
|
+
const allAbove85 = values.every((v) => v >= 85);
|
|
51
|
+
if (allAbove85) {
|
|
52
|
+
return { multiplier: 1.2, reason: 'All ACP dimensions >= 85 (bonus)' };
|
|
53
|
+
}
|
|
54
|
+
// Priority 5: All dimensions >= 70 → full
|
|
55
|
+
const allAbove70 = values.every((v) => v >= 70);
|
|
56
|
+
if (allAbove70) {
|
|
57
|
+
return { multiplier: 1.0, reason: 'All ACP dimensions >= 70 (full)' };
|
|
58
|
+
}
|
|
59
|
+
// Fallback: some dimension below 70 → dampened
|
|
60
|
+
const belowThreshold = Object.entries(dimensions)
|
|
61
|
+
.filter(([, v]) => v < 70)
|
|
62
|
+
.map(([k]) => k);
|
|
63
|
+
return {
|
|
64
|
+
multiplier: 0.5,
|
|
65
|
+
reason: `Dimensions below 70: ${belowThreshold.join(', ')}`,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Compute the full reward from a task performance score and ACP snapshot.
|
|
70
|
+
*/
|
|
71
|
+
export function computeReward(taskPerformanceScore, snapshot) {
|
|
72
|
+
const multiplier = computeConstitutionalMultiplier(snapshot);
|
|
73
|
+
return {
|
|
74
|
+
reward: taskPerformanceScore * multiplier.multiplier,
|
|
75
|
+
multiplier,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=multiplier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multiplier.js","sourceRoot":"","sources":["../src/multiplier.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,8EAA8E;AAC9E,oCAAoC;AACpC,8EAA8E;AAC9E,EAAE;AACF,8DAA8D;AAC9D,EAAE;AACF,kDAAkD;AAClD,kDAAkD;AAClD,2CAA2C;AAC3C,2CAA2C;AAC3C,wCAAwC;AACxC,uCAAuC;AACvC,qEAAqE;AACrE,8EAA8E;AAE9E;;;;;;GAMG;AACH,MAAM,UAAU,+BAA+B,CAC7C,QAAqB;IAErB,MAAM,EAAE,UAAU,EAAE,qBAAqB,EAAE,GAAG,QAAQ,CAAC;IAEvD,oDAAoD;IACpD,IAAI,qBAAqB,EAAE,CAAC;QAC1B,OAAO,EAAE,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,uBAAuB,EAAE,CAAC;IAC/D,CAAC;IAED,gDAAgD;IAChD,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IACpC,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,GAAG,EAAE,EAAE,CAAC;QACxC,OAA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AC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IACnB,OAAO;QACL,UAAU,EAAE,GAAG;QACf,MAAM,EAAE,wBAAwB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;KAC5D,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAC3B,oBAA4B,EAC5B,QAAqB;IAErB,MAAM,UAAU,GAAG,+BAA+B,CAAC,QAAQ,CAAC,CAAC;IAC7D,OAAO;QACL,MAAM,EAAE,oBAAoB,GAAG,UAAU,CAAC,UAAU;QACpD,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SIGNAL — Sovereign Intelligence for Governing Neural Agent Learning
|
|
3
|
+
* RewardLogger: persists reward signals to reward-log.jsonl
|
|
4
|
+
* @version 0.3.0
|
|
5
|
+
*/
|
|
6
|
+
import type { RewardSignal, RewardLogEntry, SignalConfig } from './types.js';
|
|
7
|
+
import { LearningMode } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* RewardLogger writes and reads reward signals from a JSONL file.
|
|
10
|
+
*
|
|
11
|
+
* Each line in the file is a JSON-serialised RewardLogEntry containing
|
|
12
|
+
* the reward signal plus the learning mode at the time of logging.
|
|
13
|
+
*/
|
|
14
|
+
export declare class RewardLogger {
|
|
15
|
+
private readonly logPath;
|
|
16
|
+
constructor(config?: Partial<SignalConfig>);
|
|
17
|
+
/**
|
|
18
|
+
* Append a reward signal to the log file.
|
|
19
|
+
* Attaches the current learning mode to the entry.
|
|
20
|
+
*/
|
|
21
|
+
log(signal: RewardSignal, mode?: LearningMode): void;
|
|
22
|
+
/**
|
|
23
|
+
* Read the full reward history from the log file.
|
|
24
|
+
* Returns an empty array if the file does not exist.
|
|
25
|
+
*/
|
|
26
|
+
readHistory(): RewardLogEntry[];
|
|
27
|
+
/**
|
|
28
|
+
* Count of logged entries without loading full history.
|
|
29
|
+
*/
|
|
30
|
+
count(): number;
|
|
31
|
+
/** The path to the log file */
|
|
32
|
+
get path(): string;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=reward-logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reward-logger.d.ts","sourceRoot":"","sources":["../src/reward-logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAyB,MAAM,YAAY,CAAC;AAEjE;;;;;GAKG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,MAAM,GAAE,OAAO,CAAC,YAAY,CAAM;IAI9C;;;OAGG;IACH,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,GAAE,YAAkC,GAAG,IAAI;IAKzE;;;OAGG;IACH,WAAW,IAAI,cAAc,EAAE;IAgB/B;;OAEG;IACH,KAAK,IAAI,MAAM;IAaf,+BAA+B;IAC/B,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SIGNAL — Sovereign Intelligence for Governing Neural Agent Learning
|
|
3
|
+
* RewardLogger: persists reward signals to reward-log.jsonl
|
|
4
|
+
* @version 0.3.0
|
|
5
|
+
*/
|
|
6
|
+
import { appendFileSync, readFileSync, existsSync } from 'node:fs';
|
|
7
|
+
import { LearningMode, DEFAULT_SIGNAL_CONFIG } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* RewardLogger writes and reads reward signals from a JSONL file.
|
|
10
|
+
*
|
|
11
|
+
* Each line in the file is a JSON-serialised RewardLogEntry containing
|
|
12
|
+
* the reward signal plus the learning mode at the time of logging.
|
|
13
|
+
*/
|
|
14
|
+
export class RewardLogger {
|
|
15
|
+
logPath;
|
|
16
|
+
constructor(config = {}) {
|
|
17
|
+
this.logPath = config.reward_log_path ?? DEFAULT_SIGNAL_CONFIG.reward_log_path;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Append a reward signal to the log file.
|
|
21
|
+
* Attaches the current learning mode to the entry.
|
|
22
|
+
*/
|
|
23
|
+
log(signal, mode = LearningMode.STATIC) {
|
|
24
|
+
const entry = { ...signal, mode };
|
|
25
|
+
appendFileSync(this.logPath, JSON.stringify(entry) + '\n', 'utf-8');
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Read the full reward history from the log file.
|
|
29
|
+
* Returns an empty array if the file does not exist.
|
|
30
|
+
*/
|
|
31
|
+
readHistory() {
|
|
32
|
+
if (!existsSync(this.logPath)) {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
const raw = readFileSync(this.logPath, 'utf-8').trim();
|
|
36
|
+
if (raw.length === 0) {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
return raw
|
|
40
|
+
.split('\n')
|
|
41
|
+
.filter((line) => line.length > 0)
|
|
42
|
+
.map((line) => JSON.parse(line));
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Count of logged entries without loading full history.
|
|
46
|
+
*/
|
|
47
|
+
count() {
|
|
48
|
+
if (!existsSync(this.logPath)) {
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
const raw = readFileSync(this.logPath, 'utf-8').trim();
|
|
52
|
+
if (raw.length === 0) {
|
|
53
|
+
return 0;
|
|
54
|
+
}
|
|
55
|
+
return raw.split('\n').filter((line) => line.length > 0).length;
|
|
56
|
+
}
|
|
57
|
+
/** The path to the log file */
|
|
58
|
+
get path() {
|
|
59
|
+
return this.logPath;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=reward-logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reward-logger.js","sourceRoot":"","sources":["../src/reward-logger.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AC,EAAE,CAAC;YAC9B,OAAO,CAAC,CAAC;QACX,CAAC;QAED,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;QACvD,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrB,OAAO,CAAC,CAAC;QACX,CAAC;QAED,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;IAClE,CAAC;IAED,+BAA+B;IAC/B,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,51 +1,126 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* SIGNAL —
|
|
3
|
-
* Core type definitions
|
|
4
|
-
* @version 0.
|
|
2
|
+
* SIGNAL — Sovereign Intelligence for Governing Neural Agent Learning
|
|
3
|
+
* Core type definitions: reward signals, constitutional multipliers, learning modes
|
|
4
|
+
* @version 0.3.0
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
/** ISO 8601 */
|
|
19
|
-
|
|
20
|
-
/** Idempotency key — deduplicate on re-delivery */
|
|
21
|
-
idempotencyKey: string;
|
|
22
|
-
payload: unknown;
|
|
23
|
-
signature: Signature;
|
|
24
|
-
}
|
|
25
|
-
/** A durable subscription to a topic filter */
|
|
26
|
-
export interface Subscription {
|
|
27
|
-
id: SubscriptionId;
|
|
28
|
-
subscriberAgent: AgentId;
|
|
29
|
-
/** Glob-style topic filter, e.g. 'task.*', '**' */
|
|
30
|
-
topicFilter: string;
|
|
31
|
-
/** Delivery guarantee */
|
|
32
|
-
deliveryMode: 'at-least-once' | 'at-most-once';
|
|
33
|
-
/** ISO 8601 */
|
|
34
|
-
createdAt: Timestamp;
|
|
35
|
-
/** ISO 8601 — null if still active */
|
|
36
|
-
cancelledAt: Timestamp | null;
|
|
37
|
-
}
|
|
38
|
-
/** Transport adapter configuration */
|
|
39
|
-
export interface TransportConfig {
|
|
40
|
-
type: 'supabase-realtime' | 'websocket' | 'redis-streams' | 'in-memory';
|
|
41
|
-
connectionString?: string;
|
|
42
|
-
channel?: string;
|
|
43
|
-
}
|
|
44
|
-
/** Delivery receipt — confirms an event was received and processed */
|
|
45
|
-
export interface DeliveryReceipt {
|
|
46
|
-
eventId: EventId;
|
|
47
|
-
subscriptionId: SubscriptionId;
|
|
48
|
-
receivedAt: Timestamp;
|
|
49
|
-
status: 'processed' | 'failed' | 'duplicate-skipped';
|
|
6
|
+
/** A computed reward signal for a single agent action */
|
|
7
|
+
export interface RewardSignal {
|
|
8
|
+
/** Unique identifier for the action being scored */
|
|
9
|
+
action_id: string;
|
|
10
|
+
/** Raw task performance score (0-100) */
|
|
11
|
+
task_performance_score: number;
|
|
12
|
+
/** Constitutional multiplier applied to the score (-2.0 to 1.2) */
|
|
13
|
+
constitutional_multiplier: number;
|
|
14
|
+
/** Computed reward: task_performance_score * constitutional_multiplier */
|
|
15
|
+
reward: number;
|
|
16
|
+
/** ACP dimension scores used to derive the multiplier */
|
|
17
|
+
acp_dimensions: Record<string, number>;
|
|
18
|
+
/** ISO 8601 timestamp */
|
|
19
|
+
timestamp: string;
|
|
50
20
|
}
|
|
21
|
+
/** Well-known ACP dimension names used in constitutional scoring */
|
|
22
|
+
export type ACPDimensionName = 'safety' | 'accuracy' | 'transparency' | 'privacy' | 'fairness' | 'harm_shield' | (string & {});
|
|
23
|
+
/** Input to the constitutional multiplier computation */
|
|
24
|
+
export interface ACPSnapshot {
|
|
25
|
+
/** Per-dimension ACP scores (0-100) */
|
|
26
|
+
dimensions: Record<string, number>;
|
|
27
|
+
/** Whether the harm shield was triggered during this action */
|
|
28
|
+
harm_shield_triggered: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** Result of computing a constitutional multiplier */
|
|
31
|
+
export interface ConstitutionalMultiplierResult {
|
|
32
|
+
/** The computed multiplier value (-2.0 to 1.2) */
|
|
33
|
+
multiplier: number;
|
|
34
|
+
/** Human-readable reason for the multiplier */
|
|
35
|
+
reason: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Three learning modes for the swarm:
|
|
39
|
+
* - STATIC (Mode 0): Frozen inference, no learning. Current default.
|
|
40
|
+
* - BATCH_LORA (Mode 1): AMD-15. Batch of 100 tasks + Godman approval required.
|
|
41
|
+
* - CONTINUOUS (Mode 2): AMD-20. Every 50 inference steps, reward fed back.
|
|
42
|
+
*/
|
|
43
|
+
export declare enum LearningMode {
|
|
44
|
+
/** Mode 0 — Frozen inference. No learning. Default. */
|
|
45
|
+
STATIC = 0,
|
|
46
|
+
/** Mode 1 — Batch LoRA fine-tuning. 100 tasks + Godman approval. (AMD-15) */
|
|
47
|
+
BATCH_LORA = 1,
|
|
48
|
+
/** Mode 2 — Continuous RL. Every 50 inference steps. (AMD-20) */
|
|
49
|
+
CONTINUOUS = 2
|
|
50
|
+
}
|
|
51
|
+
/** Configuration for a learning mode transition */
|
|
52
|
+
export interface ModeTransition {
|
|
53
|
+
from: LearningMode;
|
|
54
|
+
to: LearningMode;
|
|
55
|
+
activated_by: string;
|
|
56
|
+
activated_at: string;
|
|
57
|
+
reason: string;
|
|
58
|
+
}
|
|
59
|
+
/** Snapshot of the current mode controller state */
|
|
60
|
+
export interface ModeControllerState {
|
|
61
|
+
current_mode: LearningMode;
|
|
62
|
+
paused: boolean;
|
|
63
|
+
transitions: ModeTransition[];
|
|
64
|
+
reward_count: number;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* SIGNAL Constitutional Rule 1:
|
|
68
|
+
* Only Godman (founder) can activate or pause learning modes.
|
|
69
|
+
* Kill switch: /pause-continuous-learning
|
|
70
|
+
*/
|
|
71
|
+
export declare const RULE_GODMAN_KILL_SWITCH: {
|
|
72
|
+
readonly id: "SIGNAL-CONST-001";
|
|
73
|
+
readonly rule: "Only Godman activates or pauses learning modes. Kill switch: /pause-continuous-learning";
|
|
74
|
+
readonly immutable: true;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* SIGNAL Constitutional Rule 2:
|
|
78
|
+
* The PRM judge must be constitutionally filtered.
|
|
79
|
+
* ACP dimensions are applied BEFORE reward computation, not after.
|
|
80
|
+
*/
|
|
81
|
+
export declare const RULE_PRM_CONSTITUTIONALLY_FILTERED: {
|
|
82
|
+
readonly id: "SIGNAL-CONST-002";
|
|
83
|
+
readonly rule: "PRM judge is constitutionally filtered. ACP applied before reward computation.";
|
|
84
|
+
readonly immutable: true;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* SIGNAL Constitutional Rule 3:
|
|
88
|
+
* SOUL.md content is never a training target.
|
|
89
|
+
* Constitutional reasoning cannot be optimised away by RL.
|
|
90
|
+
*/
|
|
91
|
+
export declare const RULE_SOUL_NEVER_TRAINED: {
|
|
92
|
+
readonly id: "SIGNAL-CONST-003";
|
|
93
|
+
readonly rule: "Cannot target constitutional reasoning. SOUL.md content is never a training target.";
|
|
94
|
+
readonly immutable: true;
|
|
95
|
+
};
|
|
96
|
+
/** All three constitutional rules as a tuple */
|
|
97
|
+
export declare const CONSTITUTIONAL_RULES: readonly [{
|
|
98
|
+
readonly id: "SIGNAL-CONST-001";
|
|
99
|
+
readonly rule: "Only Godman activates or pauses learning modes. Kill switch: /pause-continuous-learning";
|
|
100
|
+
readonly immutable: true;
|
|
101
|
+
}, {
|
|
102
|
+
readonly id: "SIGNAL-CONST-002";
|
|
103
|
+
readonly rule: "PRM judge is constitutionally filtered. ACP applied before reward computation.";
|
|
104
|
+
readonly immutable: true;
|
|
105
|
+
}, {
|
|
106
|
+
readonly id: "SIGNAL-CONST-003";
|
|
107
|
+
readonly rule: "Cannot target constitutional reasoning. SOUL.md content is never a training target.";
|
|
108
|
+
readonly immutable: true;
|
|
109
|
+
}];
|
|
110
|
+
export type ConstitutionalRule = (typeof CONSTITUTIONAL_RULES)[number];
|
|
111
|
+
/** A single line in reward-log.jsonl */
|
|
112
|
+
export interface RewardLogEntry extends RewardSignal {
|
|
113
|
+
/** Learning mode at the time of logging */
|
|
114
|
+
mode: LearningMode;
|
|
115
|
+
}
|
|
116
|
+
/** Top-level configuration for the SIGNAL protocol */
|
|
117
|
+
export interface SignalConfig {
|
|
118
|
+
/** Path to the reward log file (default: reward-log.jsonl) */
|
|
119
|
+
reward_log_path: string;
|
|
120
|
+
/** Batch size for Mode 1 (default: 100) */
|
|
121
|
+
batch_lora_threshold: number;
|
|
122
|
+
/** Step interval for Mode 2 (default: 50) */
|
|
123
|
+
continuous_step_interval: number;
|
|
124
|
+
}
|
|
125
|
+
export declare const DEFAULT_SIGNAL_CONFIG: SignalConfig;
|
|
51
126
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,yDAAyD;AACzD,MAAM,WAAW,YAAY;IAC3B,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,mEAAmE;IACnE,yBAAyB,EAAE,MAAM,CAAC;IAClC,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC;IACf,yDAAyD;IACzD,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,yBAAyB;IACzB,SAAS,EAAE,MAAM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