@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.
Files changed (51) hide show
  1. package/index.js +1270 -1270
  2. package/openclaw.plugin.json +29 -29
  3. package/package.json +55 -55
  4. package/runtime/cli/commands/connector-init.js +11 -4
  5. package/runtime/cli/index.js +6 -1
  6. package/runtime/cli/ops/heartbeat-surface.d.ts +75 -75
  7. package/runtime/cli/ops/heartbeat-surface.js +97 -97
  8. package/runtime/cli/ops/ops-router.js +1428 -1428
  9. package/runtime/cli/ops/workspace-heartbeat-runner.js +236 -236
  10. package/runtime/connectors/services/connector-executor-adapter.js +192 -41
  11. package/runtime/core/second-nature/body/tool-affordance/affordance-context-scope.d.ts +1 -1
  12. package/runtime/core/second-nature/body/tool-affordance/affordance-context-scope.js +2 -1
  13. package/runtime/core/second-nature/guidance/apply-guidance.d.ts +12 -12
  14. package/runtime/core/second-nature/guidance/apply-guidance.js +15 -15
  15. package/runtime/core/second-nature/guidance/user-reply-continuity.d.ts +50 -50
  16. package/runtime/core/second-nature/guidance/user-reply-continuity.js +89 -89
  17. package/runtime/core/second-nature/orchestrator/intent-planner.js +15 -0
  18. package/runtime/core/second-nature/runtime/service-entry.d.ts +39 -39
  19. package/runtime/core/second-nature/runtime/service-entry.js +44 -44
  20. package/runtime/dream/dream-engine.d.ts +14 -14
  21. package/runtime/dream/dream-engine.js +306 -306
  22. package/runtime/dream/dream-input-loader.d.ts +37 -37
  23. package/runtime/dream/dream-input-loader.js +150 -150
  24. package/runtime/dream/dream-scheduler.d.ts +75 -75
  25. package/runtime/dream/dream-scheduler.js +131 -131
  26. package/runtime/dream/index.d.ts +16 -16
  27. package/runtime/dream/index.js +14 -14
  28. package/runtime/dream/insight-extractor.d.ts +32 -32
  29. package/runtime/dream/insight-extractor.js +135 -135
  30. package/runtime/dream/memory-consolidator.d.ts +45 -45
  31. package/runtime/dream/memory-consolidator.js +140 -140
  32. package/runtime/dream/narrative-update-proposal.d.ts +34 -34
  33. package/runtime/dream/narrative-update-proposal.js +83 -83
  34. package/runtime/dream/output-validator.d.ts +20 -20
  35. package/runtime/dream/output-validator.js +110 -110
  36. package/runtime/dream/redaction-gate.d.ts +31 -31
  37. package/runtime/dream/redaction-gate.js +109 -109
  38. package/runtime/dream/relationship-update-proposal.d.ts +27 -27
  39. package/runtime/dream/relationship-update-proposal.js +119 -119
  40. package/runtime/dream/sampler.d.ts +30 -30
  41. package/runtime/dream/sampler.js +65 -65
  42. package/runtime/dream/types.d.ts +187 -187
  43. package/runtime/dream/types.js +11 -11
  44. package/runtime/guidance/fallback.js +20 -20
  45. package/runtime/guidance/guidance-assembler.js +76 -76
  46. package/runtime/guidance/output-guard.d.ts +13 -13
  47. package/runtime/guidance/output-guard.js +53 -53
  48. package/runtime/guidance/template-registry.d.ts +20 -20
  49. package/runtime/guidance/template-registry.js +93 -93
  50. package/runtime/guidance/types.d.ts +98 -98
  51. 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
+ }