@rozek/nanoclaw 0.0.5 → 0.0.6

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 (132) hide show
  1. package/container/agent-runner/package-lock.json +1524 -0
  2. package/dist/cli.js +39 -4
  3. package/dist/cli.js.map +1 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +34 -0
  6. package/dist/index.js.map +1 -1
  7. package/package.json +7 -1
  8. package/.claude/settings.json +0 -1
  9. package/.claude/skills/add-compact/SKILL.md +0 -135
  10. package/.claude/skills/add-discord/SKILL.md +0 -203
  11. package/.claude/skills/add-gmail/SKILL.md +0 -220
  12. package/.claude/skills/add-image-vision/SKILL.md +0 -94
  13. package/.claude/skills/add-ollama-tool/SKILL.md +0 -153
  14. package/.claude/skills/add-parallel/SKILL.md +0 -290
  15. package/.claude/skills/add-pdf-reader/SKILL.md +0 -104
  16. package/.claude/skills/add-reactions/SKILL.md +0 -117
  17. package/.claude/skills/add-slack/SKILL.md +0 -207
  18. package/.claude/skills/add-telegram/SKILL.md +0 -222
  19. package/.claude/skills/add-telegram-swarm/SKILL.md +0 -384
  20. package/.claude/skills/add-voice-transcription/SKILL.md +0 -148
  21. package/.claude/skills/add-whatsapp/SKILL.md +0 -372
  22. package/.claude/skills/convert-to-apple-container/SKILL.md +0 -175
  23. package/.claude/skills/customize/SKILL.md +0 -110
  24. package/.claude/skills/debug/SKILL.md +0 -349
  25. package/.claude/skills/get-qodo-rules/SKILL.md +0 -122
  26. package/.claude/skills/get-qodo-rules/references/output-format.md +0 -41
  27. package/.claude/skills/get-qodo-rules/references/pagination.md +0 -33
  28. package/.claude/skills/get-qodo-rules/references/repository-scope.md +0 -26
  29. package/.claude/skills/qodo-pr-resolver/SKILL.md +0 -326
  30. package/.claude/skills/qodo-pr-resolver/resources/providers.md +0 -329
  31. package/.claude/skills/setup/SKILL.md +0 -218
  32. package/.claude/skills/update-nanoclaw/SKILL.md +0 -235
  33. package/.claude/skills/update-skills/SKILL.md +0 -130
  34. package/.claude/skills/use-local-whisper/SKILL.md +0 -152
  35. package/.claude/skills/x-integration/SKILL.md +0 -417
  36. package/.claude/skills/x-integration/agent.ts +0 -243
  37. package/.claude/skills/x-integration/host.ts +0 -159
  38. package/.claude/skills/x-integration/lib/browser.ts +0 -148
  39. package/.claude/skills/x-integration/lib/config.ts +0 -62
  40. package/.claude/skills/x-integration/scripts/like.ts +0 -56
  41. package/.claude/skills/x-integration/scripts/post.ts +0 -66
  42. package/.claude/skills/x-integration/scripts/quote.ts +0 -80
  43. package/.claude/skills/x-integration/scripts/reply.ts +0 -74
  44. package/.claude/skills/x-integration/scripts/retweet.ts +0 -62
  45. package/.claude/skills/x-integration/scripts/setup.ts +0 -87
  46. package/.env.example +0 -1
  47. package/.github/CODEOWNERS +0 -10
  48. package/.github/PULL_REQUEST_TEMPLATE.md +0 -14
  49. package/.github/workflows/bump-version.yml +0 -32
  50. package/.github/workflows/ci.yml +0 -25
  51. package/.github/workflows/merge-forward-skills.yml +0 -160
  52. package/.github/workflows/update-tokens.yml +0 -42
  53. package/.husky/pre-commit +0 -1
  54. package/.mcp.json +0 -3
  55. package/.nvmrc +0 -1
  56. package/.prettierrc +0 -3
  57. package/CHANGELOG.md +0 -8
  58. package/CONTRIBUTING.md +0 -23
  59. package/CONTRIBUTORS.md +0 -15
  60. package/NanoClaw_with_Web-Support.md +0 -326
  61. package/README_zh.md +0 -200
  62. package/assets/nanoclaw-favicon.png +0 -0
  63. package/assets/nanoclaw-icon.png +0 -0
  64. package/assets/nanoclaw-logo-dark.png +0 -0
  65. package/assets/nanoclaw-logo.png +0 -0
  66. package/assets/nanoclaw-profile.jpeg +0 -0
  67. package/assets/nanoclaw-sales.png +0 -0
  68. package/assets/social-preview.jpg +0 -0
  69. package/config-examples/mount-allowlist.json +0 -25
  70. package/docs/APPLE-CONTAINER-NETWORKING.md +0 -90
  71. package/docs/DEBUG_CHECKLIST.md +0 -143
  72. package/docs/REQUIREMENTS.md +0 -196
  73. package/docs/SDK_DEEP_DIVE.md +0 -643
  74. package/docs/SECURITY.md +0 -122
  75. package/docs/SPEC.md +0 -785
  76. package/docs/docker-sandboxes.md +0 -359
  77. package/docs/nanoclaw-architecture-final.md +0 -1063
  78. package/docs/nanorepo-architecture.md +0 -168
  79. package/docs/skills-as-branches.md +0 -662
  80. package/groups/global/CLAUDE.md +0 -58
  81. package/groups/main/CLAUDE.md +0 -246
  82. package/launchd/com.nanoclaw.plist +0 -32
  83. package/repo-tokens/README.md +0 -113
  84. package/repo-tokens/action.yml +0 -186
  85. package/repo-tokens/badge.svg +0 -23
  86. package/repo-tokens/examples/green.svg +0 -14
  87. package/repo-tokens/examples/red.svg +0 -14
  88. package/repo-tokens/examples/yellow-green.svg +0 -14
  89. package/repo-tokens/examples/yellow.svg +0 -14
  90. package/scripts/run-migrations.ts +0 -105
  91. package/setup.sh +0 -161
  92. package/src/channels/index.ts +0 -15
  93. package/src/channels/registry.test.ts +0 -42
  94. package/src/channels/registry.ts +0 -32
  95. package/src/channels/web.ts +0 -1931
  96. package/src/cli.ts +0 -254
  97. package/src/config.ts +0 -73
  98. package/src/container-runner.test.ts +0 -210
  99. package/src/container-runner.ts +0 -768
  100. package/src/container-runtime.test.ts +0 -149
  101. package/src/container-runtime.ts +0 -127
  102. package/src/credential-proxy.test.ts +0 -192
  103. package/src/credential-proxy.ts +0 -125
  104. package/src/db.test.ts +0 -484
  105. package/src/db.ts +0 -803
  106. package/src/env.ts +0 -42
  107. package/src/formatting.test.ts +0 -256
  108. package/src/group-folder.test.ts +0 -43
  109. package/src/group-folder.ts +0 -44
  110. package/src/group-queue.test.ts +0 -484
  111. package/src/group-queue.ts +0 -379
  112. package/src/index.ts +0 -854
  113. package/src/ipc-auth.test.ts +0 -679
  114. package/src/ipc.ts +0 -461
  115. package/src/logger.ts +0 -16
  116. package/src/mount-security.ts +0 -419
  117. package/src/remote-control.test.ts +0 -397
  118. package/src/remote-control.ts +0 -224
  119. package/src/router.ts +0 -52
  120. package/src/routing.test.ts +0 -170
  121. package/src/sender-allowlist.test.ts +0 -216
  122. package/src/sender-allowlist.ts +0 -128
  123. package/src/session-commands.test.ts +0 -247
  124. package/src/session-commands.ts +0 -163
  125. package/src/task-scheduler.test.ts +0 -129
  126. package/src/task-scheduler.ts +0 -328
  127. package/src/timezone.test.ts +0 -29
  128. package/src/timezone.ts +0 -16
  129. package/src/types.ts +0 -109
  130. package/tsconfig.json +0 -20
  131. package/vitest.config.ts +0 -7
  132. package/vitest.skills.config.ts +0 -7
@@ -1,14 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="90" height="20" role="img" aria-label="158k tokens">
2
- <title>158k tokens</title>
3
- <linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient>
4
- <clipPath id="r"><rect width="90" height="20" rx="3"/></clipPath>
5
- <g clip-path="url(#r)">
6
- <rect width="52" height="20" fill="#555"/>
7
- <rect x="52" width="38" height="20" fill="#e05d44"/>
8
- <rect width="90" height="20" fill="url(#s)"/>
9
- <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
10
- <text x="26" y="15" fill="#010101" fill-opacity=".3">tokens</text><text x="26" y="14">tokens</text>
11
- <text x="71" y="15" fill="#010101" fill-opacity=".3">158k</text><text x="71" y="14">158k</text>
12
- </g>
13
- </g>
14
- </svg>
@@ -1,14 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="97" height="20" role="img" aria-label="74.8k tokens">
2
- <title>74.8k tokens</title>
3
- <linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient>
4
- <clipPath id="r"><rect width="97" height="20" rx="3"/></clipPath>
5
- <g clip-path="url(#r)">
6
- <rect width="52" height="20" fill="#555"/>
7
- <rect x="52" width="45" height="20" fill="#97ca00"/>
8
- <rect width="97" height="20" fill="url(#s)"/>
9
- <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
10
- <text x="26" y="15" fill="#010101" fill-opacity=".3">tokens</text><text x="26" y="14">tokens</text>
11
- <text x="74" y="15" fill="#010101" fill-opacity=".3">74.8k</text><text x="74" y="14">74.8k</text>
12
- </g>
13
- </g>
14
- </svg>
@@ -1,14 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="90" height="20" role="img" aria-label="120k tokens">
2
- <title>120k tokens</title>
3
- <linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient>
4
- <clipPath id="r"><rect width="90" height="20" rx="3"/></clipPath>
5
- <g clip-path="url(#r)">
6
- <rect width="52" height="20" fill="#555"/>
7
- <rect x="52" width="38" height="20" fill="#dfb317"/>
8
- <rect width="90" height="20" fill="url(#s)"/>
9
- <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
10
- <text x="26" y="15" fill="#010101" fill-opacity=".3">tokens</text><text x="26" y="14">tokens</text>
11
- <text x="71" y="15" fill="#010101" fill-opacity=".3">120k</text><text x="71" y="14">120k</text>
12
- </g>
13
- </g>
14
- </svg>
@@ -1,105 +0,0 @@
1
- #!/usr/bin/env tsx
2
- import { execFileSync, execSync } from 'child_process';
3
- import fs from 'fs';
4
- import path from 'path';
5
-
6
- function compareSemver(a: string, b: string): number {
7
- const partsA = a.split('.').map(Number);
8
- const partsB = b.split('.').map(Number);
9
- for (let i = 0; i < Math.max(partsA.length, partsB.length); i++) {
10
- const diff = (partsA[i] || 0) - (partsB[i] || 0);
11
- if (diff !== 0) return diff;
12
- }
13
- return 0;
14
- }
15
-
16
- // Resolve tsx binary once to avoid npx race conditions across migrations
17
- function resolveTsx(): string {
18
- // Check local node_modules first
19
- const local = path.resolve('node_modules/.bin/tsx');
20
- if (fs.existsSync(local)) return local;
21
- // Fall back to whichever tsx is in PATH
22
- try {
23
- return execSync('which tsx', { encoding: 'utf-8' }).trim();
24
- } catch {
25
- return 'npx'; // last resort
26
- }
27
- }
28
-
29
- const tsxBin = resolveTsx();
30
-
31
- const fromVersion = process.argv[2];
32
- const toVersion = process.argv[3];
33
- const newCorePath = process.argv[4];
34
-
35
- if (!fromVersion || !toVersion || !newCorePath) {
36
- console.error(
37
- 'Usage: tsx scripts/run-migrations.ts <from-version> <to-version> <new-core-path>',
38
- );
39
- process.exit(1);
40
- }
41
-
42
- interface MigrationResult {
43
- version: string;
44
- success: boolean;
45
- error?: string;
46
- }
47
-
48
- const results: MigrationResult[] = [];
49
-
50
- // Look for migrations in the new core
51
- const migrationsDir = path.join(newCorePath, 'migrations');
52
-
53
- if (!fs.existsSync(migrationsDir)) {
54
- console.log(JSON.stringify({ migrationsRun: 0, results: [] }, null, 2));
55
- process.exit(0);
56
- }
57
-
58
- // Discover migration directories (version-named)
59
- const entries = fs.readdirSync(migrationsDir, { withFileTypes: true });
60
- const migrationVersions = entries
61
- .filter((e) => e.isDirectory() && /^\d+\.\d+\.\d+$/.test(e.name))
62
- .map((e) => e.name)
63
- .filter(
64
- (v) =>
65
- compareSemver(v, fromVersion) > 0 && compareSemver(v, toVersion) <= 0,
66
- )
67
- .sort(compareSemver);
68
-
69
- const projectRoot = process.cwd();
70
-
71
- for (const version of migrationVersions) {
72
- const migrationIndex = path.join(migrationsDir, version, 'index.ts');
73
- if (!fs.existsSync(migrationIndex)) {
74
- results.push({
75
- version,
76
- success: false,
77
- error: `Migration ${version}/index.ts not found`,
78
- });
79
- continue;
80
- }
81
-
82
- try {
83
- const tsxArgs = tsxBin.endsWith('npx')
84
- ? ['tsx', migrationIndex, projectRoot]
85
- : [migrationIndex, projectRoot];
86
- execFileSync(tsxBin, tsxArgs, {
87
- stdio: 'pipe',
88
- cwd: projectRoot,
89
- timeout: 120_000,
90
- });
91
- results.push({ version, success: true });
92
- } catch (err) {
93
- const message = err instanceof Error ? err.message : String(err);
94
- results.push({ version, success: false, error: message });
95
- }
96
- }
97
-
98
- console.log(
99
- JSON.stringify({ migrationsRun: results.length, results }, null, 2),
100
- );
101
-
102
- // Exit with error if any migration failed
103
- if (results.some((r) => !r.success)) {
104
- process.exit(1);
105
- }
package/setup.sh DELETED
@@ -1,161 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
-
4
- # setup.sh — Bootstrap script for NanoClaw
5
- # Handles Node.js/npm setup, then hands off to the Node.js setup modules.
6
- # This is the only bash script in the setup flow.
7
-
8
- PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9
- LOG_FILE="$PROJECT_ROOT/logs/setup.log"
10
-
11
- mkdir -p "$PROJECT_ROOT/logs"
12
-
13
- log() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] [bootstrap] $*" >> "$LOG_FILE"; }
14
-
15
- # --- Platform detection ---
16
-
17
- detect_platform() {
18
- local uname_s
19
- uname_s=$(uname -s)
20
- case "$uname_s" in
21
- Darwin*) PLATFORM="macos" ;;
22
- Linux*) PLATFORM="linux" ;;
23
- *) PLATFORM="unknown" ;;
24
- esac
25
-
26
- IS_WSL="false"
27
- if [ "$PLATFORM" = "linux" ] && [ -f /proc/version ]; then
28
- if grep -qi 'microsoft\|wsl' /proc/version 2>/dev/null; then
29
- IS_WSL="true"
30
- fi
31
- fi
32
-
33
- IS_ROOT="false"
34
- if [ "$(id -u)" -eq 0 ]; then
35
- IS_ROOT="true"
36
- fi
37
-
38
- log "Platform: $PLATFORM, WSL: $IS_WSL, Root: $IS_ROOT"
39
- }
40
-
41
- # --- Node.js check ---
42
-
43
- check_node() {
44
- NODE_OK="false"
45
- NODE_VERSION="not_found"
46
- NODE_PATH_FOUND=""
47
-
48
- if command -v node >/dev/null 2>&1; then
49
- NODE_VERSION=$(node --version 2>/dev/null | sed 's/^v//')
50
- NODE_PATH_FOUND=$(command -v node)
51
- local major
52
- major=$(echo "$NODE_VERSION" | cut -d. -f1)
53
- if [ "$major" -ge 20 ] 2>/dev/null; then
54
- NODE_OK="true"
55
- fi
56
- log "Node $NODE_VERSION at $NODE_PATH_FOUND (major=$major, ok=$NODE_OK)"
57
- else
58
- log "Node not found"
59
- fi
60
- }
61
-
62
- # --- npm install ---
63
-
64
- install_deps() {
65
- DEPS_OK="false"
66
- NATIVE_OK="false"
67
-
68
- if [ "$NODE_OK" = "false" ]; then
69
- log "Skipping npm install — Node not available"
70
- return
71
- fi
72
-
73
- cd "$PROJECT_ROOT"
74
-
75
- # npm install with --unsafe-perm if root (needed for native modules)
76
- local npm_flags=""
77
- if [ "$IS_ROOT" = "true" ]; then
78
- npm_flags="--unsafe-perm"
79
- log "Running as root, using --unsafe-perm"
80
- fi
81
-
82
- log "Running npm ci $npm_flags"
83
- if npm ci $npm_flags >> "$LOG_FILE" 2>&1; then
84
- DEPS_OK="true"
85
- log "npm install succeeded"
86
- else
87
- log "npm install failed"
88
- return
89
- fi
90
-
91
- # Verify native module (better-sqlite3)
92
- log "Verifying native modules"
93
- if node -e "require('better-sqlite3')" >> "$LOG_FILE" 2>&1; then
94
- NATIVE_OK="true"
95
- log "better-sqlite3 loads OK"
96
- else
97
- log "better-sqlite3 failed to load"
98
- fi
99
- }
100
-
101
- # --- Build tools check ---
102
-
103
- check_build_tools() {
104
- HAS_BUILD_TOOLS="false"
105
-
106
- if [ "$PLATFORM" = "macos" ]; then
107
- if xcode-select -p >/dev/null 2>&1; then
108
- HAS_BUILD_TOOLS="true"
109
- fi
110
- elif [ "$PLATFORM" = "linux" ]; then
111
- if command -v gcc >/dev/null 2>&1 && command -v make >/dev/null 2>&1; then
112
- HAS_BUILD_TOOLS="true"
113
- fi
114
- fi
115
-
116
- log "Build tools: $HAS_BUILD_TOOLS"
117
- }
118
-
119
- # --- Main ---
120
-
121
- log "=== Bootstrap started ==="
122
-
123
- detect_platform
124
- check_node
125
- install_deps
126
- check_build_tools
127
-
128
- # Emit status block
129
- STATUS="success"
130
- if [ "$NODE_OK" = "false" ]; then
131
- STATUS="node_missing"
132
- elif [ "$DEPS_OK" = "false" ]; then
133
- STATUS="deps_failed"
134
- elif [ "$NATIVE_OK" = "false" ]; then
135
- STATUS="native_failed"
136
- fi
137
-
138
- cat <<EOF
139
- === NANOCLAW SETUP: BOOTSTRAP ===
140
- PLATFORM: $PLATFORM
141
- IS_WSL: $IS_WSL
142
- IS_ROOT: $IS_ROOT
143
- NODE_VERSION: $NODE_VERSION
144
- NODE_OK: $NODE_OK
145
- NODE_PATH: ${NODE_PATH_FOUND:-not_found}
146
- DEPS_OK: $DEPS_OK
147
- NATIVE_OK: $NATIVE_OK
148
- HAS_BUILD_TOOLS: $HAS_BUILD_TOOLS
149
- STATUS: $STATUS
150
- LOG: logs/setup.log
151
- === END ===
152
- EOF
153
-
154
- log "=== Bootstrap completed: $STATUS ==="
155
-
156
- if [ "$NODE_OK" = "false" ]; then
157
- exit 2
158
- fi
159
- if [ "$DEPS_OK" = "false" ] || [ "$NATIVE_OK" = "false" ]; then
160
- exit 1
161
- fi
@@ -1,15 +0,0 @@
1
- // Channel self-registration barrel file.
2
- // Each import triggers the channel module's registerChannel() call.
3
-
4
- // discord
5
-
6
- // gmail
7
-
8
- // slack
9
-
10
- // telegram
11
-
12
- // whatsapp
13
-
14
- // web
15
- import './web.js';
@@ -1,42 +0,0 @@
1
- import { describe, it, expect, beforeEach } from 'vitest';
2
-
3
- import {
4
- registerChannel,
5
- getChannelFactory,
6
- getRegisteredChannelNames,
7
- } from './registry.js';
8
-
9
- // The registry is module-level state, so we need a fresh module per test.
10
- // We use dynamic import with cache-busting to isolate tests.
11
- // However, since vitest runs each file in its own context and we control
12
- // registration order, we can test the public API directly.
13
-
14
- describe('channel registry', () => {
15
- // Note: registry is shared module state across tests in this file.
16
- // Tests are ordered to account for cumulative registrations.
17
-
18
- it('getChannelFactory returns undefined for unknown channel', () => {
19
- expect(getChannelFactory('nonexistent')).toBeUndefined();
20
- });
21
-
22
- it('registerChannel and getChannelFactory round-trip', () => {
23
- const factory = () => null;
24
- registerChannel('test-channel', factory);
25
- expect(getChannelFactory('test-channel')).toBe(factory);
26
- });
27
-
28
- it('getRegisteredChannelNames includes registered channels', () => {
29
- registerChannel('another-channel', () => null);
30
- const names = getRegisteredChannelNames();
31
- expect(names).toContain('test-channel');
32
- expect(names).toContain('another-channel');
33
- });
34
-
35
- it('later registration overwrites earlier one', () => {
36
- const factory1 = () => null;
37
- const factory2 = () => null;
38
- registerChannel('overwrite-test', factory1);
39
- registerChannel('overwrite-test', factory2);
40
- expect(getChannelFactory('overwrite-test')).toBe(factory2);
41
- });
42
- });
@@ -1,32 +0,0 @@
1
- import {
2
- Channel,
3
- OnInboundMessage,
4
- OnChatMetadata,
5
- RegisteredGroup,
6
- } from '../types.js';
7
-
8
- export interface ChannelOpts {
9
- onMessage: OnInboundMessage;
10
- onChatMetadata: OnChatMetadata;
11
- registeredGroups: () => Record<string, RegisteredGroup>;
12
- // Optional: channels that self-register their main group call this during connect()
13
- registerGroup?: (jid: string, group: RegisteredGroup) => void;
14
- // Optional: cancel the active agent run for a JID (e.g. write _close sentinel)
15
- onCancelRequest?: (jid: string) => void;
16
- }
17
-
18
- export type ChannelFactory = (opts: ChannelOpts) => Channel | null;
19
-
20
- const registry = new Map<string, ChannelFactory>();
21
-
22
- export function registerChannel(name: string, factory: ChannelFactory): void {
23
- registry.set(name, factory);
24
- }
25
-
26
- export function getChannelFactory(name: string): ChannelFactory | undefined {
27
- return registry.get(name);
28
- }
29
-
30
- export function getRegisteredChannelNames(): string[] {
31
- return [...registry.keys()];
32
- }