@haaaiawd/second-nature 0.1.39 → 0.1.41
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/index.js +1270 -1270
- package/openclaw.plugin.json +29 -29
- package/package.json +55 -55
- package/runtime/cli/commands/connector-init.js +11 -4
- package/runtime/cli/index.js +6 -1
- package/runtime/cli/ops/heartbeat-surface.d.ts +75 -75
- package/runtime/cli/ops/heartbeat-surface.js +97 -97
- package/runtime/cli/ops/ops-router.js +1428 -1428
- package/runtime/cli/ops/workspace-heartbeat-runner.js +236 -236
- package/runtime/connectors/services/connector-executor-adapter.js +192 -41
- package/runtime/core/second-nature/body/tool-affordance/affordance-context-scope.d.ts +1 -1
- package/runtime/core/second-nature/body/tool-affordance/affordance-context-scope.js +2 -1
- package/runtime/core/second-nature/guidance/apply-guidance.d.ts +12 -12
- package/runtime/core/second-nature/guidance/apply-guidance.js +15 -15
- package/runtime/core/second-nature/guidance/user-reply-continuity.d.ts +50 -50
- package/runtime/core/second-nature/guidance/user-reply-continuity.js +89 -89
- package/runtime/core/second-nature/orchestrator/intent-planner.js +15 -0
- package/runtime/core/second-nature/runtime/service-entry.d.ts +39 -39
- package/runtime/core/second-nature/runtime/service-entry.js +44 -44
- package/runtime/dream/dream-engine.d.ts +14 -14
- package/runtime/dream/dream-engine.js +306 -306
- package/runtime/dream/dream-input-loader.d.ts +37 -37
- package/runtime/dream/dream-input-loader.js +150 -150
- package/runtime/dream/dream-scheduler.d.ts +75 -75
- package/runtime/dream/dream-scheduler.js +131 -131
- package/runtime/dream/index.d.ts +16 -16
- package/runtime/dream/index.js +14 -14
- package/runtime/dream/insight-extractor.d.ts +32 -32
- package/runtime/dream/insight-extractor.js +135 -135
- package/runtime/dream/memory-consolidator.d.ts +45 -45
- package/runtime/dream/memory-consolidator.js +140 -140
- package/runtime/dream/narrative-update-proposal.d.ts +34 -34
- package/runtime/dream/narrative-update-proposal.js +83 -83
- package/runtime/dream/output-validator.d.ts +20 -20
- package/runtime/dream/output-validator.js +110 -110
- package/runtime/dream/redaction-gate.d.ts +31 -31
- package/runtime/dream/redaction-gate.js +109 -109
- package/runtime/dream/relationship-update-proposal.d.ts +27 -27
- package/runtime/dream/relationship-update-proposal.js +119 -119
- package/runtime/dream/sampler.d.ts +30 -30
- package/runtime/dream/sampler.js +65 -65
- package/runtime/dream/types.d.ts +187 -187
- package/runtime/dream/types.js +11 -11
- package/runtime/guidance/fallback.js +20 -20
- package/runtime/guidance/guidance-assembler.js +76 -76
- package/runtime/guidance/output-guard.d.ts +13 -13
- package/runtime/guidance/output-guard.js +53 -53
- package/runtime/guidance/template-registry.d.ts +20 -20
- package/runtime/guidance/template-registry.js +93 -93
- package/runtime/guidance/types.d.ts +98 -98
- package/runtime/observability/projections/guidance-audit.js +38 -38
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
export type GuidanceSceneType = "social" | "reply" | "outreach" | "quiet" | "explain" | "user_reply";
|
|
2
|
-
export type GuidanceMode = "active" | "quiet" | "maintenance_only" | "paused_for_interrupt";
|
|
3
|
-
export type GuidanceRiskLevel = "low" | "medium" | "high";
|
|
4
|
-
export type AtmosphereOpenness = "open" | "narrow" | "quiet";
|
|
5
|
-
export type ImpulseKind = "social" | "reply" | "outreach" | "quiet" | "explore" | "work";
|
|
6
|
-
export type PersonaSource = "SOUL" | "USER" | "IDENTITY" | "MEMORY";
|
|
7
|
-
export type TemplateReviewStatus = "pending_human_review" | "approved" | "rejected";
|
|
8
|
-
export interface SceneContext {
|
|
9
|
-
sceneType: GuidanceSceneType;
|
|
10
|
-
mode: GuidanceMode;
|
|
11
|
-
windowId?: string;
|
|
12
|
-
riskLevel?: GuidanceRiskLevel;
|
|
13
|
-
sceneSummary?: string;
|
|
14
|
-
constraintSummary?: string[];
|
|
15
|
-
/**
|
|
16
|
-
* T-V7C.C.4R: The capability being executed (e.g. "post.publish", "feed.read").
|
|
17
|
-
* Used by ImpulseAssembler to derive capabilityClass for dual-axis impulse selection.
|
|
18
|
-
* When absent, assembler falls back to sceneType-based impulse.
|
|
19
|
-
*/
|
|
20
|
-
capabilityIntent?: string;
|
|
21
|
-
/**
|
|
22
|
-
* T-V7C.C.4R: The target platform identifier (e.g. "moltbook", "instreet").
|
|
23
|
-
* Used by ImpulseAssembler to check for platform-specific impulse overrides.
|
|
24
|
-
* When absent, platform-specific lookup is skipped.
|
|
25
|
-
*/
|
|
26
|
-
platformId?: string;
|
|
27
|
-
}
|
|
28
|
-
export interface AtmosphereBlock {
|
|
29
|
-
kind: "atmosphere";
|
|
30
|
-
text: string;
|
|
31
|
-
openness: AtmosphereOpenness;
|
|
32
|
-
pressureLabels: string[];
|
|
33
|
-
reviewStatus: TemplateReviewStatus;
|
|
34
|
-
}
|
|
35
|
-
export interface ImpulseBlock {
|
|
36
|
-
kind: ImpulseKind;
|
|
37
|
-
text: string;
|
|
38
|
-
reviewStatus: TemplateReviewStatus;
|
|
39
|
-
}
|
|
40
|
-
export interface PersonaCandidate {
|
|
41
|
-
id: string;
|
|
42
|
-
source: PersonaSource;
|
|
43
|
-
text: string;
|
|
44
|
-
tags: string[];
|
|
45
|
-
}
|
|
46
|
-
export interface PersonaSnippet {
|
|
47
|
-
candidateId: string;
|
|
48
|
-
source: PersonaSource;
|
|
49
|
-
text: string;
|
|
50
|
-
rationale: string;
|
|
51
|
-
}
|
|
52
|
-
export interface GuardBlock {
|
|
53
|
-
kind: "output_guard";
|
|
54
|
-
constraints: string[];
|
|
55
|
-
hardGuardPriority: true;
|
|
56
|
-
/** @deprecated Use ExpressionBoundaryBlock via buildExpressionBoundary. Kept for backward compatibility. */
|
|
57
|
-
_semanticNote?: "output_guard_only_shapes_expression";
|
|
58
|
-
}
|
|
59
|
-
export interface ExpressionBoundaryBlock {
|
|
60
|
-
kind: "expression_boundary";
|
|
61
|
-
constraints: string[];
|
|
62
|
-
/** Avoid/prefer style constraints; never format specs or hard guard verdicts. */
|
|
63
|
-
style: "avoid_prefer";
|
|
64
|
-
/** Explicitly marks this block as shaping expression only, not action allow/deny. */
|
|
65
|
-
ownership: "behavioral_guidance_system";
|
|
66
|
-
}
|
|
67
|
-
export interface PersonaInjectionBudget {
|
|
68
|
-
maxSnippets: number;
|
|
69
|
-
maxTotalCharacters: number;
|
|
70
|
-
}
|
|
71
|
-
export interface GuidancePayload {
|
|
72
|
-
scene: SceneContext;
|
|
73
|
-
atmosphere?: AtmosphereBlock;
|
|
74
|
-
impulses: ImpulseBlock[];
|
|
75
|
-
personaReinforcement: PersonaSnippet[];
|
|
76
|
-
/** @deprecated Use expressionBoundary. Kept for backward compatibility. */
|
|
77
|
-
outputGuard?: GuardBlock;
|
|
78
|
-
expressionBoundary?: ExpressionBoundaryBlock;
|
|
79
|
-
}
|
|
80
|
-
export interface GuidanceUnavailable {
|
|
81
|
-
available: false;
|
|
82
|
-
reason: "guidance_not_configured" | "missing_scene_context" | "missing_template" | "persona_assets_unavailable";
|
|
83
|
-
}
|
|
84
|
-
export interface GuidanceFallback {
|
|
85
|
-
scene: SceneContext;
|
|
86
|
-
atmosphere?: AtmosphereBlock;
|
|
87
|
-
impulses: ImpulseBlock[];
|
|
88
|
-
personaReinforcement: [];
|
|
89
|
-
/** @deprecated Use expressionBoundary. Kept for backward compatibility. */
|
|
90
|
-
outputGuard: GuardBlock;
|
|
91
|
-
expressionBoundary?: ExpressionBoundaryBlock;
|
|
92
|
-
minimal: true;
|
|
93
|
-
}
|
|
94
|
-
export interface PersonaSelectionDecision {
|
|
95
|
-
sceneType: GuidanceSceneType;
|
|
96
|
-
budget: PersonaInjectionBudget;
|
|
97
|
-
snippets: PersonaSnippet[];
|
|
98
|
-
}
|
|
1
|
+
export type GuidanceSceneType = "social" | "reply" | "outreach" | "quiet" | "explain" | "user_reply";
|
|
2
|
+
export type GuidanceMode = "active" | "quiet" | "maintenance_only" | "paused_for_interrupt";
|
|
3
|
+
export type GuidanceRiskLevel = "low" | "medium" | "high";
|
|
4
|
+
export type AtmosphereOpenness = "open" | "narrow" | "quiet";
|
|
5
|
+
export type ImpulseKind = "social" | "reply" | "outreach" | "quiet" | "explore" | "work";
|
|
6
|
+
export type PersonaSource = "SOUL" | "USER" | "IDENTITY" | "MEMORY";
|
|
7
|
+
export type TemplateReviewStatus = "pending_human_review" | "approved" | "rejected";
|
|
8
|
+
export interface SceneContext {
|
|
9
|
+
sceneType: GuidanceSceneType;
|
|
10
|
+
mode: GuidanceMode;
|
|
11
|
+
windowId?: string;
|
|
12
|
+
riskLevel?: GuidanceRiskLevel;
|
|
13
|
+
sceneSummary?: string;
|
|
14
|
+
constraintSummary?: string[];
|
|
15
|
+
/**
|
|
16
|
+
* T-V7C.C.4R: The capability being executed (e.g. "post.publish", "feed.read").
|
|
17
|
+
* Used by ImpulseAssembler to derive capabilityClass for dual-axis impulse selection.
|
|
18
|
+
* When absent, assembler falls back to sceneType-based impulse.
|
|
19
|
+
*/
|
|
20
|
+
capabilityIntent?: string;
|
|
21
|
+
/**
|
|
22
|
+
* T-V7C.C.4R: The target platform identifier (e.g. "moltbook", "instreet").
|
|
23
|
+
* Used by ImpulseAssembler to check for platform-specific impulse overrides.
|
|
24
|
+
* When absent, platform-specific lookup is skipped.
|
|
25
|
+
*/
|
|
26
|
+
platformId?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface AtmosphereBlock {
|
|
29
|
+
kind: "atmosphere";
|
|
30
|
+
text: string;
|
|
31
|
+
openness: AtmosphereOpenness;
|
|
32
|
+
pressureLabels: string[];
|
|
33
|
+
reviewStatus: TemplateReviewStatus;
|
|
34
|
+
}
|
|
35
|
+
export interface ImpulseBlock {
|
|
36
|
+
kind: ImpulseKind;
|
|
37
|
+
text: string;
|
|
38
|
+
reviewStatus: TemplateReviewStatus;
|
|
39
|
+
}
|
|
40
|
+
export interface PersonaCandidate {
|
|
41
|
+
id: string;
|
|
42
|
+
source: PersonaSource;
|
|
43
|
+
text: string;
|
|
44
|
+
tags: string[];
|
|
45
|
+
}
|
|
46
|
+
export interface PersonaSnippet {
|
|
47
|
+
candidateId: string;
|
|
48
|
+
source: PersonaSource;
|
|
49
|
+
text: string;
|
|
50
|
+
rationale: string;
|
|
51
|
+
}
|
|
52
|
+
export interface GuardBlock {
|
|
53
|
+
kind: "output_guard";
|
|
54
|
+
constraints: string[];
|
|
55
|
+
hardGuardPriority: true;
|
|
56
|
+
/** @deprecated Use ExpressionBoundaryBlock via buildExpressionBoundary. Kept for backward compatibility. */
|
|
57
|
+
_semanticNote?: "output_guard_only_shapes_expression";
|
|
58
|
+
}
|
|
59
|
+
export interface ExpressionBoundaryBlock {
|
|
60
|
+
kind: "expression_boundary";
|
|
61
|
+
constraints: string[];
|
|
62
|
+
/** Avoid/prefer style constraints; never format specs or hard guard verdicts. */
|
|
63
|
+
style: "avoid_prefer";
|
|
64
|
+
/** Explicitly marks this block as shaping expression only, not action allow/deny. */
|
|
65
|
+
ownership: "behavioral_guidance_system";
|
|
66
|
+
}
|
|
67
|
+
export interface PersonaInjectionBudget {
|
|
68
|
+
maxSnippets: number;
|
|
69
|
+
maxTotalCharacters: number;
|
|
70
|
+
}
|
|
71
|
+
export interface GuidancePayload {
|
|
72
|
+
scene: SceneContext;
|
|
73
|
+
atmosphere?: AtmosphereBlock;
|
|
74
|
+
impulses: ImpulseBlock[];
|
|
75
|
+
personaReinforcement: PersonaSnippet[];
|
|
76
|
+
/** @deprecated Use expressionBoundary. Kept for backward compatibility. */
|
|
77
|
+
outputGuard?: GuardBlock;
|
|
78
|
+
expressionBoundary?: ExpressionBoundaryBlock;
|
|
79
|
+
}
|
|
80
|
+
export interface GuidanceUnavailable {
|
|
81
|
+
available: false;
|
|
82
|
+
reason: "guidance_not_configured" | "missing_scene_context" | "missing_template" | "persona_assets_unavailable";
|
|
83
|
+
}
|
|
84
|
+
export interface GuidanceFallback {
|
|
85
|
+
scene: SceneContext;
|
|
86
|
+
atmosphere?: AtmosphereBlock;
|
|
87
|
+
impulses: ImpulseBlock[];
|
|
88
|
+
personaReinforcement: [];
|
|
89
|
+
/** @deprecated Use expressionBoundary. Kept for backward compatibility. */
|
|
90
|
+
outputGuard: GuardBlock;
|
|
91
|
+
expressionBoundary?: ExpressionBoundaryBlock;
|
|
92
|
+
minimal: true;
|
|
93
|
+
}
|
|
94
|
+
export interface PersonaSelectionDecision {
|
|
95
|
+
sceneType: GuidanceSceneType;
|
|
96
|
+
budget: PersonaInjectionBudget;
|
|
97
|
+
snippets: PersonaSnippet[];
|
|
98
|
+
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
function summarizePayloadBlocks(payload) {
|
|
2
|
-
if ("available" in payload) {
|
|
3
|
-
return [`unavailable:${payload.reason}`];
|
|
4
|
-
}
|
|
5
|
-
const blocks = [];
|
|
6
|
-
if (payload.atmosphere) {
|
|
7
|
-
blocks.push("atmosphere");
|
|
8
|
-
}
|
|
9
|
-
if (payload.impulses.length > 0) {
|
|
10
|
-
blocks.push(...payload.impulses.map((item) => `impulse:${item.kind}`));
|
|
11
|
-
}
|
|
12
|
-
if (payload.personaReinforcement.length > 0) {
|
|
13
|
-
blocks.push(`persona:${payload.personaReinforcement.length}`);
|
|
14
|
-
}
|
|
15
|
-
if (payload.expressionBoundary) {
|
|
16
|
-
blocks.push("expression_boundary");
|
|
17
|
-
}
|
|
18
|
-
else if (payload.outputGuard) {
|
|
19
|
-
blocks.push("output_guard");
|
|
20
|
-
}
|
|
21
|
-
return blocks;
|
|
22
|
-
}
|
|
23
|
-
function summarizeRationales(payload) {
|
|
24
|
-
if ("available" in payload) {
|
|
25
|
-
return [];
|
|
26
|
-
}
|
|
27
|
-
return payload.personaReinforcement.map((item) => item.rationale);
|
|
28
|
-
}
|
|
29
|
-
export function projectGuidanceParticipationAudit(input) {
|
|
30
|
-
return {
|
|
31
|
-
eventId: input.id,
|
|
32
|
-
sceneType: input.sceneContext.sceneType,
|
|
33
|
-
usedFallback: input.usedFallback,
|
|
34
|
-
guidanceAvailable: !(("available" in input.payload) && input.payload.available === false),
|
|
35
|
-
blockSummary: summarizePayloadBlocks(input.payload),
|
|
36
|
-
snippetRationales: summarizeRationales(input.payload),
|
|
37
|
-
};
|
|
38
|
-
}
|
|
1
|
+
function summarizePayloadBlocks(payload) {
|
|
2
|
+
if ("available" in payload) {
|
|
3
|
+
return [`unavailable:${payload.reason}`];
|
|
4
|
+
}
|
|
5
|
+
const blocks = [];
|
|
6
|
+
if (payload.atmosphere) {
|
|
7
|
+
blocks.push("atmosphere");
|
|
8
|
+
}
|
|
9
|
+
if (payload.impulses.length > 0) {
|
|
10
|
+
blocks.push(...payload.impulses.map((item) => `impulse:${item.kind}`));
|
|
11
|
+
}
|
|
12
|
+
if (payload.personaReinforcement.length > 0) {
|
|
13
|
+
blocks.push(`persona:${payload.personaReinforcement.length}`);
|
|
14
|
+
}
|
|
15
|
+
if (payload.expressionBoundary) {
|
|
16
|
+
blocks.push("expression_boundary");
|
|
17
|
+
}
|
|
18
|
+
else if (payload.outputGuard) {
|
|
19
|
+
blocks.push("output_guard");
|
|
20
|
+
}
|
|
21
|
+
return blocks;
|
|
22
|
+
}
|
|
23
|
+
function summarizeRationales(payload) {
|
|
24
|
+
if ("available" in payload) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
return payload.personaReinforcement.map((item) => item.rationale);
|
|
28
|
+
}
|
|
29
|
+
export function projectGuidanceParticipationAudit(input) {
|
|
30
|
+
return {
|
|
31
|
+
eventId: input.id,
|
|
32
|
+
sceneType: input.sceneContext.sceneType,
|
|
33
|
+
usedFallback: input.usedFallback,
|
|
34
|
+
guidanceAvailable: !(("available" in input.payload) && input.payload.available === false),
|
|
35
|
+
blockSummary: summarizePayloadBlocks(input.payload),
|
|
36
|
+
snippetRationales: summarizeRationales(input.payload),
|
|
37
|
+
};
|
|
38
|
+
}
|