typeclaw 0.8.0 → 0.9.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/README.md +6 -6
- package/package.json +5 -3
- package/scripts/require-parallel.ts +41 -0
- package/src/agent/index.ts +55 -6
- package/src/agent/live-sessions.ts +34 -0
- package/src/agent/plugin-tools.ts +2 -0
- package/src/agent/session-meta.ts +21 -2
- package/src/agent/subagent-completion-reminder.ts +89 -0
- package/src/agent/subagents.ts +3 -2
- package/src/agent/system-prompt.ts +10 -8
- package/src/bundled-plugins/explorer/explorer.ts +2 -2
- package/src/bundled-plugins/guard/index.ts +14 -1
- package/src/bundled-plugins/guard/policies/managed-config.ts +43 -13
- package/src/bundled-plugins/guard/policies/memory-retrieval-cache-write.ts +37 -0
- package/src/bundled-plugins/guard/policies/memory-topics-delete.ts +67 -0
- package/src/bundled-plugins/guard/policies/memory-topics-write.ts +33 -0
- package/src/bundled-plugins/guard/policies/non-workspace-write.ts +8 -2
- package/src/bundled-plugins/guard/policy.ts +7 -0
- package/src/bundled-plugins/memory/README.md +76 -62
- package/src/bundled-plugins/memory/append-tool.ts +3 -2
- package/src/bundled-plugins/memory/citation-superset.ts +49 -11
- package/src/bundled-plugins/memory/citations.ts +19 -8
- package/src/bundled-plugins/memory/delete-tool.ts +57 -0
- package/src/bundled-plugins/memory/dreaming-state.ts +1 -1
- package/src/bundled-plugins/memory/dreaming.ts +364 -146
- package/src/bundled-plugins/memory/frontmatter.ts +165 -0
- package/src/bundled-plugins/memory/index.ts +236 -16
- package/src/bundled-plugins/memory/injection-plan.ts +15 -0
- package/src/bundled-plugins/memory/load-memory.ts +102 -103
- package/src/bundled-plugins/memory/load-shards.ts +156 -0
- package/src/bundled-plugins/memory/memory-logger.ts +16 -15
- package/src/bundled-plugins/memory/memory-retrieval.ts +105 -0
- package/src/bundled-plugins/memory/migration.ts +282 -1
- package/src/bundled-plugins/memory/paths.ts +42 -0
- package/src/bundled-plugins/memory/search-tool.ts +232 -0
- package/src/bundled-plugins/memory/secret-detector.ts +2 -2
- package/src/bundled-plugins/memory/shard-snapshot.ts +51 -0
- package/src/bundled-plugins/memory/slug.ts +59 -0
- package/src/bundled-plugins/memory/stream-io.ts +110 -1
- package/src/bundled-plugins/memory/strength.ts +3 -3
- package/src/bundled-plugins/memory/topics.ts +70 -16
- package/src/bundled-plugins/security/index.ts +24 -0
- package/src/bundled-plugins/security/permissions.ts +4 -0
- package/src/bundled-plugins/security/policies/cron-promotion.ts +349 -0
- package/src/bundled-plugins/security/policies/git-exfil.ts +2 -0
- package/src/bundled-plugins/security/policies/prompt-injection.ts +3 -0
- package/src/bundled-plugins/security/policies/role-promotion.ts +419 -0
- package/src/bundled-plugins/security/policies/system-prompt-leak.ts +1 -0
- package/src/channels/adapters/kakaotalk-attachment.ts +7 -17
- package/src/channels/adapters/kakaotalk.ts +64 -37
- package/src/channels/adapters/slack-bot-classify.ts +2 -27
- package/src/channels/index.ts +5 -0
- package/src/channels/router.ts +201 -17
- package/src/channels/subagent-completion-bridge.ts +84 -0
- package/src/cli/builtins.ts +1 -0
- package/src/cli/index.ts +1 -0
- package/src/cli/init.ts +122 -14
- package/src/cli/inspect.ts +151 -0
- package/src/cron/consumer.ts +1 -1
- package/src/init/dockerfile.ts +268 -4
- package/src/init/hatching.ts +5 -6
- package/src/init/kakaotalk-auth.ts +6 -47
- package/src/init/validate-api-key.ts +121 -0
- package/src/inspect/index.ts +213 -0
- package/src/inspect/label.ts +50 -0
- package/src/inspect/live.ts +221 -0
- package/src/inspect/render.ts +163 -0
- package/src/inspect/replay.ts +265 -0
- package/src/inspect/session-list.ts +160 -0
- package/src/inspect/types.ts +110 -0
- package/src/plugin/hooks.ts +23 -1
- package/src/plugin/index.ts +2 -0
- package/src/plugin/manager.ts +1 -1
- package/src/plugin/registry.ts +1 -1
- package/src/plugin/types.ts +10 -0
- package/src/run/channel-session-factory.ts +7 -1
- package/src/run/index.ts +87 -21
- package/src/secrets/kakao-renewal.ts +3 -47
- package/src/server/index.ts +241 -60
- package/src/shared/index.ts +3 -0
- package/src/shared/protocol.ts +49 -0
- package/src/skills/typeclaw-channel-kakaotalk/SKILL.md +9 -9
- package/src/skills/typeclaw-claude-code/SKILL.md +57 -39
- package/src/skills/typeclaw-claude-code/references/stop-hook.md +2 -0
- package/src/skills/typeclaw-claude-code/references/tmux-driving.md +102 -16
- package/src/skills/typeclaw-config/SKILL.md +1 -1
- package/src/skills/typeclaw-cron/SKILL.md +1 -1
- package/src/skills/typeclaw-memory/SKILL.md +16 -163
- package/src/skills/typeclaw-permissions/SKILL.md +2 -2
- package/src/skills/typeclaw-plugins/SKILL.md +25 -14
- package/src/test-helpers/wait-for.ts +7 -1
- package/typeclaw.schema.json +7 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { unlink } from 'node:fs/promises'
|
|
2
|
+
import { isAbsolute, join, relative } from 'node:path'
|
|
3
|
+
|
|
4
|
+
import { z } from 'zod'
|
|
5
|
+
|
|
6
|
+
const SLUG_REGEX = /^[a-z0-9][a-z0-9-]{0,63}$/
|
|
7
|
+
|
|
8
|
+
export const deleteTopicShardTool = {
|
|
9
|
+
name: 'delete_topic_shard',
|
|
10
|
+
description:
|
|
11
|
+
'Delete a single topic shard file under memory/topics/. Only accepts relative paths of the form memory/topics/<slug>.md. Returns structured result; never throws.',
|
|
12
|
+
inputSchema: z.object({ path: z.string() }),
|
|
13
|
+
async run(input: { path: string }, ctx: { agentDir: string }) {
|
|
14
|
+
const rawPath = input.path.trim()
|
|
15
|
+
|
|
16
|
+
if (isAbsolute(rawPath) || rawPath.includes(':') || rawPath.includes('\\')) {
|
|
17
|
+
return { ok: false, reason: 'invalid_path' }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const segments = rawPath.split('/').filter(Boolean)
|
|
21
|
+
if (segments.includes('..')) {
|
|
22
|
+
return { ok: false, reason: 'invalid_path' }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (!/^memory\/topics\/[^/]+\.md$/.test(rawPath)) {
|
|
26
|
+
return { ok: false, reason: 'invalid_path' }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const slug = rawPath.slice('memory/topics/'.length, -'.md'.length)
|
|
30
|
+
if (!SLUG_REGEX.test(slug)) {
|
|
31
|
+
return { ok: false, reason: 'invalid_slug' }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const targetPath = join(ctx.agentDir, 'memory', 'topics', `${slug}.md`)
|
|
35
|
+
const expectedDir = join(ctx.agentDir, 'memory', 'topics')
|
|
36
|
+
const rel = relative(expectedDir, targetPath)
|
|
37
|
+
if (rel.startsWith('..') || isAbsolute(rel)) {
|
|
38
|
+
return { ok: false, reason: 'invalid_path' }
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
await unlink(targetPath)
|
|
43
|
+
} catch (err) {
|
|
44
|
+
if (isEnoent(err)) {
|
|
45
|
+
return { ok: false, reason: 'not_found' }
|
|
46
|
+
}
|
|
47
|
+
const message = err instanceof Error ? err.message : String(err)
|
|
48
|
+
return { ok: false, reason: 'fs_error', message }
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return { ok: true, path: `memory/topics/${slug}.md` }
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function isEnoent(err: unknown): boolean {
|
|
56
|
+
return err instanceof Error && 'code' in err && (err as Error & { code: string }).code === 'ENOENT'
|
|
57
|
+
}
|
|
@@ -8,7 +8,7 @@ const VERSION = 2
|
|
|
8
8
|
|
|
9
9
|
// Per-day "dreamed" set: the set of stream-event ids dreaming has already
|
|
10
10
|
// reasoned over for a given day. Anything in this set is either cited from
|
|
11
|
-
//
|
|
11
|
+
// memory/topics/ (must survive compaction) or was consciously discarded by a
|
|
12
12
|
// dreaming run (safe to GC). The undreamed-tail computation is set
|
|
13
13
|
// difference: events whose id is NOT in this set are the new things to look
|
|
14
14
|
// at on the next run.
|