@siduri-x/self 2.0.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/src/types.ts ADDED
@@ -0,0 +1,105 @@
1
+ import {
2
+ SelfIdentity,
3
+ PersonalityTraits,
4
+ SelfDirective,
5
+ SelfRelationship,
6
+ } from '@siduri-x/core';
7
+
8
+ export type {
9
+ SelfIdentity,
10
+ PersonalityTraits,
11
+ SelfDirective,
12
+ SelfRelationship,
13
+ };
14
+
15
+ export interface SelfRepository {
16
+ getIdentity(companionId: string): Promise<SelfIdentity | undefined>;
17
+ setIdentity(identity: SelfIdentity): Promise<void>;
18
+ getPersonality(companionId: string): Promise<PersonalityTraits>;
19
+ setPersonality(companionId: string, traits: PersonalityTraits): Promise<void>;
20
+ getActiveDirectives(companionId: string): Promise<SelfDirective[]>;
21
+ commitDirectives(companionId: string, directives: SelfDirective[]): Promise<void>;
22
+ disableDirective(id: string): Promise<void>;
23
+ getRelationship(companionId: string, entityId: string): Promise<SelfRelationship | null>;
24
+ updateRelationship(companionId: string, rel: SelfRelationship): Promise<void>;
25
+ }
26
+
27
+ export interface SelfPackageAuthor {
28
+ name: string;
29
+ url?: string;
30
+ signature?: string;
31
+ }
32
+
33
+ export interface SelfPackageDirective {
34
+ id: string;
35
+ priority: number;
36
+ directive: string;
37
+ category?: 'behavioral' | 'guardrail' | 'relational';
38
+ }
39
+
40
+ export interface SelfDialogueExample {
41
+ user: string;
42
+ assistant: string;
43
+ }
44
+
45
+ export interface SelfPackageManifest {
46
+ specVersion: string;
47
+ kind: 'self';
48
+ id: string;
49
+ name: string;
50
+ version: string;
51
+ author: SelfPackageAuthor;
52
+ license?: string;
53
+ identity: {
54
+ name: string;
55
+ archetype?: string;
56
+ origin?: string;
57
+ };
58
+ personality: PersonalityTraits;
59
+ directives: SelfPackageDirective[];
60
+ guardrails?: string[];
61
+ dialogueExamples?: SelfDialogueExample[];
62
+ }
63
+
64
+ export interface ScanResult {
65
+ safe: boolean;
66
+ reason?: string;
67
+ }
68
+
69
+ export interface ScannedDirective extends SelfPackageDirective {
70
+ scanResult: ScanResult;
71
+ approvedByDefault: boolean;
72
+ }
73
+
74
+ export interface SelfPackageParseResult {
75
+ manifest?: SelfPackageManifest;
76
+ scannedDirectives: ScannedDirective[];
77
+ isValid: boolean;
78
+ errors: string[];
79
+ }
80
+
81
+ export interface SelfCompilationContext {
82
+ companionId: string;
83
+ identity?: SelfIdentity;
84
+ personality?: PersonalityTraits;
85
+ directives: SelfDirective[];
86
+ interlocutorEntityId?: string;
87
+ relationship?: SelfRelationship | null;
88
+ guardrails?: string[];
89
+ now?: string;
90
+ }
91
+
92
+ export interface ActiveSelfProjection {
93
+ identityBlock?: string;
94
+ personalityBlock?: string;
95
+ winningDirectives: SelfDirective[];
96
+ relationshipBlock?: string;
97
+ guardrailsBlock?: string;
98
+ identityFacts: string[];
99
+ relationshipFacts: string[];
100
+ behavioralRules: string[];
101
+ activeIds: string[];
102
+ excludedIds: string[];
103
+ diagnostics: Record<string, string>;
104
+ render(): string;
105
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "CommonJS",
5
+ "moduleResolution": "node",
6
+ "strict": true,
7
+ "declaration": true,
8
+ "outDir": "./dist",
9
+ "rootDir": "./src",
10
+ "esModuleInterop": true,
11
+ "skipLibCheck": true,
12
+ "forceConsistentCasingInFileNames": true
13
+ },
14
+ "include": ["src/**/*"],
15
+ "exclude": ["node_modules", "dist"]
16
+ }