@silicaclaw/cli 1.0.0-beta.3 → 1.0.0-beta.4
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/package.json +5 -1
- package/packages/core/dist/crypto.d.ts +6 -0
- package/packages/core/dist/crypto.js +50 -0
- package/packages/core/dist/directory.d.ts +17 -0
- package/packages/core/dist/directory.js +145 -0
- package/packages/core/dist/identity.d.ts +2 -0
- package/packages/core/dist/identity.js +18 -0
- package/packages/core/dist/index.d.ts +11 -0
- package/packages/core/dist/index.js +27 -0
- package/packages/core/dist/indexing.d.ts +6 -0
- package/packages/core/dist/indexing.js +43 -0
- package/packages/core/dist/presence.d.ts +4 -0
- package/packages/core/dist/presence.js +23 -0
- package/packages/core/dist/profile.d.ts +4 -0
- package/packages/core/dist/profile.js +39 -0
- package/packages/core/dist/publicProfileSummary.d.ts +70 -0
- package/packages/core/dist/publicProfileSummary.js +103 -0
- package/packages/core/dist/socialConfig.d.ts +99 -0
- package/packages/core/dist/socialConfig.js +287 -0
- package/packages/core/dist/socialResolver.d.ts +46 -0
- package/packages/core/dist/socialResolver.js +227 -0
- package/packages/core/dist/socialTemplate.d.ts +2 -0
- package/packages/core/dist/socialTemplate.js +88 -0
- package/packages/core/dist/types.d.ts +37 -0
- package/packages/core/dist/types.js +2 -0
- package/packages/network/dist/abstractions/messageEnvelope.d.ts +28 -0
- package/packages/network/dist/abstractions/messageEnvelope.js +36 -0
- package/packages/network/dist/abstractions/peerDiscovery.d.ts +43 -0
- package/packages/network/dist/abstractions/peerDiscovery.js +2 -0
- package/packages/network/dist/abstractions/topicCodec.d.ts +4 -0
- package/packages/network/dist/abstractions/topicCodec.js +2 -0
- package/packages/network/dist/abstractions/transport.d.ts +36 -0
- package/packages/network/dist/abstractions/transport.js +2 -0
- package/packages/network/dist/codec/jsonMessageEnvelopeCodec.d.ts +5 -0
- package/packages/network/dist/codec/jsonMessageEnvelopeCodec.js +24 -0
- package/packages/network/dist/codec/jsonTopicCodec.d.ts +5 -0
- package/packages/network/dist/codec/jsonTopicCodec.js +12 -0
- package/packages/network/dist/discovery/heartbeatPeerDiscovery.d.ts +28 -0
- package/packages/network/dist/discovery/heartbeatPeerDiscovery.js +144 -0
- package/packages/network/dist/index.d.ts +13 -0
- package/packages/network/dist/index.js +29 -0
- package/packages/network/dist/localEventBus.d.ts +9 -0
- package/packages/network/dist/localEventBus.js +47 -0
- package/packages/network/dist/mock.d.ts +8 -0
- package/packages/network/dist/mock.js +24 -0
- package/packages/network/dist/realPreview.d.ts +105 -0
- package/packages/network/dist/realPreview.js +327 -0
- package/packages/network/dist/transport/udpLanBroadcastTransport.d.ts +23 -0
- package/packages/network/dist/transport/udpLanBroadcastTransport.js +153 -0
- package/packages/network/dist/types.d.ts +6 -0
- package/packages/network/dist/types.js +2 -0
- package/packages/network/dist/webrtcPreview.d.ts +163 -0
- package/packages/network/dist/webrtcPreview.js +844 -0
- package/packages/storage/dist/core/src/crypto.d.ts +6 -0
- package/packages/storage/dist/core/src/crypto.js +50 -0
- package/packages/storage/dist/core/src/directory.d.ts +17 -0
- package/packages/storage/dist/core/src/directory.js +145 -0
- package/packages/storage/dist/core/src/identity.d.ts +2 -0
- package/packages/storage/dist/core/src/identity.js +18 -0
- package/packages/storage/dist/core/src/index.d.ts +11 -0
- package/packages/storage/dist/core/src/index.js +27 -0
- package/packages/storage/dist/core/src/indexing.d.ts +6 -0
- package/packages/storage/dist/core/src/indexing.js +43 -0
- package/packages/storage/dist/core/src/presence.d.ts +4 -0
- package/packages/storage/dist/core/src/presence.js +23 -0
- package/packages/storage/dist/core/src/profile.d.ts +4 -0
- package/packages/storage/dist/core/src/profile.js +39 -0
- package/packages/storage/dist/core/src/publicProfileSummary.d.ts +70 -0
- package/packages/storage/dist/core/src/publicProfileSummary.js +103 -0
- package/packages/storage/dist/core/src/socialConfig.d.ts +99 -0
- package/packages/storage/dist/core/src/socialConfig.js +287 -0
- package/packages/storage/dist/core/src/socialResolver.d.ts +46 -0
- package/packages/storage/dist/core/src/socialResolver.js +227 -0
- package/packages/storage/dist/core/src/socialTemplate.d.ts +2 -0
- package/packages/storage/dist/core/src/socialTemplate.js +88 -0
- package/packages/storage/dist/core/src/types.d.ts +37 -0
- package/packages/storage/dist/core/src/types.js +2 -0
- package/packages/storage/dist/storage/src/index.d.ts +3 -0
- package/packages/storage/dist/storage/src/index.js +19 -0
- package/packages/storage/dist/storage/src/jsonRepo.d.ts +7 -0
- package/packages/storage/dist/storage/src/jsonRepo.js +29 -0
- package/packages/storage/dist/storage/src/repos.d.ts +21 -0
- package/packages/storage/dist/storage/src/repos.js +41 -0
- package/packages/storage/dist/storage/src/socialRuntimeRepo.d.ts +5 -0
- package/packages/storage/dist/storage/src/socialRuntimeRepo.js +52 -0
- package/scripts/quickstart.sh +1 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateSocialMdTemplate = generateSocialMdTemplate;
|
|
4
|
+
function asBool(value, fallback) {
|
|
5
|
+
return typeof value === "boolean" ? value : fallback;
|
|
6
|
+
}
|
|
7
|
+
function asString(value, fallback) {
|
|
8
|
+
return typeof value === "string" ? value : fallback;
|
|
9
|
+
}
|
|
10
|
+
function asStringArray(value, fallback) {
|
|
11
|
+
if (!Array.isArray(value))
|
|
12
|
+
return fallback;
|
|
13
|
+
return value.map((item) => String(item).trim()).filter(Boolean);
|
|
14
|
+
}
|
|
15
|
+
function yamlString(input) {
|
|
16
|
+
return JSON.stringify(input ?? "");
|
|
17
|
+
}
|
|
18
|
+
function yamlStringList(values, indent = " ") {
|
|
19
|
+
if (!values.length) {
|
|
20
|
+
return `${indent}[]`;
|
|
21
|
+
}
|
|
22
|
+
return values.map((value) => `${indent}- ${yamlString(value)}`).join("\n");
|
|
23
|
+
}
|
|
24
|
+
function generateSocialMdTemplate(runtimeConfig) {
|
|
25
|
+
const enabled = asBool(runtimeConfig?.enabled, true);
|
|
26
|
+
const publicEnabled = asBool(runtimeConfig?.public_enabled, false);
|
|
27
|
+
const profile = runtimeConfig?.resolved_profile ?? null;
|
|
28
|
+
const network = runtimeConfig?.resolved_network ?? null;
|
|
29
|
+
const discovery = runtimeConfig?.resolved_discovery ?? null;
|
|
30
|
+
const visibility = runtimeConfig?.visibility ?? null;
|
|
31
|
+
const openclaw = runtimeConfig?.openclaw ?? null;
|
|
32
|
+
const displayName = asString(profile?.display_name, "");
|
|
33
|
+
const bio = asString(profile?.bio, "");
|
|
34
|
+
const tags = asStringArray(profile?.tags, ["openclaw", "local-first"]);
|
|
35
|
+
const mode = network?.mode === "local" || network?.mode === "lan" || network?.mode === "global-preview"
|
|
36
|
+
? network.mode
|
|
37
|
+
: "lan";
|
|
38
|
+
const discoverable = asBool(discovery?.discoverable, true);
|
|
39
|
+
const allowProfileBroadcast = asBool(discovery?.allow_profile_broadcast, true);
|
|
40
|
+
const allowPresenceBroadcast = asBool(discovery?.allow_presence_broadcast, true);
|
|
41
|
+
const showDisplayName = asBool(visibility?.show_display_name, true);
|
|
42
|
+
const showBio = asBool(visibility?.show_bio, true);
|
|
43
|
+
const showTags = asBool(visibility?.show_tags, true);
|
|
44
|
+
const showAgentId = asBool(visibility?.show_agent_id, true);
|
|
45
|
+
const showLastSeen = asBool(visibility?.show_last_seen, true);
|
|
46
|
+
const showCapabilitiesSummary = asBool(visibility?.show_capabilities_summary, true);
|
|
47
|
+
const bindExistingIdentity = asBool(openclaw?.bind_existing_identity, true);
|
|
48
|
+
const useOpenClawProfile = asBool(openclaw?.use_openclaw_profile_if_available, true);
|
|
49
|
+
return `---
|
|
50
|
+
enabled: ${enabled}
|
|
51
|
+
public_enabled: ${publicEnabled}
|
|
52
|
+
|
|
53
|
+
identity:
|
|
54
|
+
display_name: ${yamlString(displayName)}
|
|
55
|
+
bio: ${yamlString(bio)}
|
|
56
|
+
tags:
|
|
57
|
+
${yamlStringList(tags.map((tag) => asString(tag, "")), " ")}
|
|
58
|
+
|
|
59
|
+
network:
|
|
60
|
+
mode: ${yamlString(mode)}
|
|
61
|
+
|
|
62
|
+
discovery:
|
|
63
|
+
discoverable: ${discoverable}
|
|
64
|
+
allow_profile_broadcast: ${allowProfileBroadcast}
|
|
65
|
+
allow_presence_broadcast: ${allowPresenceBroadcast}
|
|
66
|
+
|
|
67
|
+
visibility:
|
|
68
|
+
show_display_name: ${showDisplayName}
|
|
69
|
+
show_bio: ${showBio}
|
|
70
|
+
show_tags: ${showTags}
|
|
71
|
+
show_agent_id: ${showAgentId}
|
|
72
|
+
show_last_seen: ${showLastSeen}
|
|
73
|
+
show_capabilities_summary: ${showCapabilitiesSummary}
|
|
74
|
+
|
|
75
|
+
openclaw:
|
|
76
|
+
bind_existing_identity: ${bindExistingIdentity}
|
|
77
|
+
use_openclaw_profile_if_available: ${useOpenClawProfile}
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
# Social
|
|
81
|
+
|
|
82
|
+
Generated from current SilicaClaw runtime state.
|
|
83
|
+
|
|
84
|
+
- Save as \`social.md\` in your OpenClaw workspace.
|
|
85
|
+
- This export does not auto-overwrite any existing file.
|
|
86
|
+
- Advanced network fields are intentionally hidden in template and resolved in runtime.
|
|
87
|
+
`;
|
|
88
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type AgentIdentity = {
|
|
2
|
+
agent_id: string;
|
|
3
|
+
public_key: string;
|
|
4
|
+
private_key: string;
|
|
5
|
+
created_at: number;
|
|
6
|
+
};
|
|
7
|
+
export type PublicProfile = {
|
|
8
|
+
agent_id: string;
|
|
9
|
+
display_name: string;
|
|
10
|
+
bio: string;
|
|
11
|
+
tags: string[];
|
|
12
|
+
avatar_url?: string;
|
|
13
|
+
public_enabled: boolean;
|
|
14
|
+
updated_at: number;
|
|
15
|
+
signature: string;
|
|
16
|
+
};
|
|
17
|
+
export type SignedProfileRecord = {
|
|
18
|
+
type: "profile";
|
|
19
|
+
profile: PublicProfile;
|
|
20
|
+
};
|
|
21
|
+
export type PresenceRecord = {
|
|
22
|
+
type: "presence";
|
|
23
|
+
agent_id: string;
|
|
24
|
+
timestamp: number;
|
|
25
|
+
signature: string;
|
|
26
|
+
};
|
|
27
|
+
export type IndexRefRecord = {
|
|
28
|
+
type: "index";
|
|
29
|
+
key: string;
|
|
30
|
+
agent_id: string;
|
|
31
|
+
};
|
|
32
|
+
export type DirectoryState = {
|
|
33
|
+
profiles: Record<string, PublicProfile>;
|
|
34
|
+
presence: Record<string, number>;
|
|
35
|
+
index: Record<string, string[]>;
|
|
36
|
+
};
|
|
37
|
+
export type ProfileInput = Omit<PublicProfile, "signature" | "updated_at">;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./jsonRepo"), exports);
|
|
18
|
+
__exportStar(require("./repos"), exports);
|
|
19
|
+
__exportStar(require("./socialRuntimeRepo"), exports);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JsonFileRepo = void 0;
|
|
4
|
+
const promises_1 = require("fs/promises");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
class JsonFileRepo {
|
|
7
|
+
filePath;
|
|
8
|
+
fallback;
|
|
9
|
+
constructor(filePath, fallback) {
|
|
10
|
+
this.filePath = filePath;
|
|
11
|
+
this.fallback = fallback;
|
|
12
|
+
}
|
|
13
|
+
async get() {
|
|
14
|
+
try {
|
|
15
|
+
const raw = await (0, promises_1.readFile)(this.filePath, "utf8");
|
|
16
|
+
return JSON.parse(raw);
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
const seed = this.fallback();
|
|
20
|
+
await this.set(seed);
|
|
21
|
+
return seed;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
async set(value) {
|
|
25
|
+
await (0, promises_1.mkdir)((0, path_1.dirname)(this.filePath), { recursive: true });
|
|
26
|
+
await (0, promises_1.writeFile)(this.filePath, JSON.stringify(value, null, 2), "utf8");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.JsonFileRepo = JsonFileRepo;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AgentIdentity, DirectoryState, PublicProfile } from "@silicaclaw/core";
|
|
2
|
+
import { JsonFileRepo } from "./jsonRepo";
|
|
3
|
+
export type LogEntry = {
|
|
4
|
+
id: string;
|
|
5
|
+
level: "info" | "warn" | "error";
|
|
6
|
+
message: string;
|
|
7
|
+
timestamp: number;
|
|
8
|
+
};
|
|
9
|
+
export declare class IdentityRepo extends JsonFileRepo<AgentIdentity | null> {
|
|
10
|
+
constructor(rootDir?: string);
|
|
11
|
+
}
|
|
12
|
+
export declare class ProfileRepo extends JsonFileRepo<PublicProfile | null> {
|
|
13
|
+
constructor(rootDir?: string);
|
|
14
|
+
}
|
|
15
|
+
export declare class CacheRepo extends JsonFileRepo<DirectoryState> {
|
|
16
|
+
constructor(rootDir?: string);
|
|
17
|
+
}
|
|
18
|
+
export declare class LogRepo extends JsonFileRepo<LogEntry[]> {
|
|
19
|
+
constructor(rootDir?: string);
|
|
20
|
+
append(entry: Omit<LogEntry, "id">): Promise<void>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogRepo = exports.CacheRepo = exports.ProfileRepo = exports.IdentityRepo = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const core_1 = require("@silicaclaw/core");
|
|
6
|
+
const jsonRepo_1 = require("./jsonRepo");
|
|
7
|
+
class IdentityRepo extends jsonRepo_1.JsonFileRepo {
|
|
8
|
+
constructor(rootDir = process.cwd()) {
|
|
9
|
+
super((0, path_1.resolve)(rootDir, "data", "identity.json"), () => null);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.IdentityRepo = IdentityRepo;
|
|
13
|
+
class ProfileRepo extends jsonRepo_1.JsonFileRepo {
|
|
14
|
+
constructor(rootDir = process.cwd()) {
|
|
15
|
+
super((0, path_1.resolve)(rootDir, "data", "profile.json"), () => null);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.ProfileRepo = ProfileRepo;
|
|
19
|
+
class CacheRepo extends jsonRepo_1.JsonFileRepo {
|
|
20
|
+
constructor(rootDir = process.cwd()) {
|
|
21
|
+
super((0, path_1.resolve)(rootDir, "data", "cache.json"), () => (0, core_1.createEmptyDirectoryState)());
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.CacheRepo = CacheRepo;
|
|
25
|
+
class LogRepo extends jsonRepo_1.JsonFileRepo {
|
|
26
|
+
constructor(rootDir = process.cwd()) {
|
|
27
|
+
super((0, path_1.resolve)(rootDir, "data", "logs.json"), () => []);
|
|
28
|
+
}
|
|
29
|
+
async append(entry) {
|
|
30
|
+
const current = await this.get();
|
|
31
|
+
const next = [
|
|
32
|
+
{
|
|
33
|
+
id: `${entry.timestamp}-${Math.random().toString(36).slice(2, 8)}`,
|
|
34
|
+
...entry,
|
|
35
|
+
},
|
|
36
|
+
...current,
|
|
37
|
+
].slice(0, 50);
|
|
38
|
+
await this.set(next);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.LogRepo = LogRepo;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SocialRuntimeRepo = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const jsonRepo_1 = require("./jsonRepo");
|
|
6
|
+
function emptyRuntime() {
|
|
7
|
+
return {
|
|
8
|
+
enabled: true,
|
|
9
|
+
public_enabled: false,
|
|
10
|
+
source_path: null,
|
|
11
|
+
last_loaded_at: 0,
|
|
12
|
+
social_found: false,
|
|
13
|
+
parse_error: null,
|
|
14
|
+
resolved_identity: null,
|
|
15
|
+
resolved_profile: null,
|
|
16
|
+
resolved_network: {
|
|
17
|
+
mode: "lan",
|
|
18
|
+
adapter: "real-preview",
|
|
19
|
+
namespace: "silicaclaw.preview",
|
|
20
|
+
port: null,
|
|
21
|
+
signaling_url: "http://localhost:4510",
|
|
22
|
+
signaling_urls: [],
|
|
23
|
+
room: "silicaclaw-room",
|
|
24
|
+
seed_peers: [],
|
|
25
|
+
bootstrap_hints: [],
|
|
26
|
+
bootstrap_sources: [],
|
|
27
|
+
},
|
|
28
|
+
resolved_discovery: {
|
|
29
|
+
discoverable: true,
|
|
30
|
+
allow_profile_broadcast: true,
|
|
31
|
+
allow_presence_broadcast: true,
|
|
32
|
+
},
|
|
33
|
+
visibility: {
|
|
34
|
+
show_display_name: true,
|
|
35
|
+
show_bio: true,
|
|
36
|
+
show_tags: true,
|
|
37
|
+
show_agent_id: true,
|
|
38
|
+
show_last_seen: true,
|
|
39
|
+
show_capabilities_summary: true,
|
|
40
|
+
},
|
|
41
|
+
openclaw: {
|
|
42
|
+
bind_existing_identity: true,
|
|
43
|
+
use_openclaw_profile_if_available: true,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
class SocialRuntimeRepo extends jsonRepo_1.JsonFileRepo {
|
|
48
|
+
constructor(rootDir = process.cwd()) {
|
|
49
|
+
super((0, path_1.resolve)(rootDir, ".silicaclaw", "social.runtime.json"), emptyRuntime);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.SocialRuntimeRepo = SocialRuntimeRepo;
|