typeclaw 0.40.0 → 0.42.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.
Files changed (61) hide show
  1. package/README.md +3 -2
  2. package/auth.schema.json +57 -0
  3. package/package.json +2 -2
  4. package/secrets.schema.json +57 -0
  5. package/src/agent/index.ts +10 -6
  6. package/src/agent/multimodal/look-at.ts +87 -0
  7. package/src/agent/session-origin.ts +1 -0
  8. package/src/agent/tools/channel-history-render.ts +21 -0
  9. package/src/agent/tools/channel-history.ts +2 -17
  10. package/src/agent/tools/channel-read.ts +206 -0
  11. package/src/bundled-plugins/agent-browser/skills/agent-browser/SKILL.md +26 -2
  12. package/src/bundled-plugins/github-cli-auth/index.ts +25 -6
  13. package/src/bundled-plugins/memory/index.ts +10 -11
  14. package/src/bundled-plugins/memory/vector/hybrid.ts +73 -6
  15. package/src/bundled-plugins/memory/vector/index-on-write.ts +25 -20
  16. package/src/bundled-plugins/memory/vector/passages.ts +2 -24
  17. package/src/bundled-plugins/memory/vector/reference-index-on-write.ts +28 -23
  18. package/src/bundled-plugins/memory/vector/store.ts +2 -0
  19. package/src/bundled-plugins/memory/vector/truncation.ts +28 -0
  20. package/src/bundled-plugins/planner/planner.ts +4 -2
  21. package/src/bundled-plugins/reviewer/reviewer.ts +9 -1
  22. package/src/bundled-plugins/tool-result-cap/README.md +10 -1
  23. package/src/bundled-plugins/tool-result-cap/cap-result.ts +8 -0
  24. package/src/channels/adapters/discord-bot.ts +112 -0
  25. package/src/channels/adapters/instagram-channel-resolver.ts +113 -0
  26. package/src/channels/adapters/instagram-classify.ts +69 -0
  27. package/src/channels/adapters/instagram-format.ts +8 -0
  28. package/src/channels/adapters/instagram.ts +346 -0
  29. package/src/channels/adapters/kakaotalk-classify.ts +31 -6
  30. package/src/channels/adapters/kakaotalk.ts +1 -1
  31. package/src/channels/adapters/slack-bot.ts +147 -0
  32. package/src/channels/manager.ts +60 -2
  33. package/src/channels/router.ts +64 -0
  34. package/src/channels/schema.ts +5 -0
  35. package/src/channels/types.ts +46 -0
  36. package/src/cli/channel.ts +76 -1
  37. package/src/cli/init.ts +1 -0
  38. package/src/cli/status.ts +37 -14
  39. package/src/config/channels-mutation.ts +2 -1
  40. package/src/doctor/channel-checks.ts +28 -0
  41. package/src/hostd/daemon.ts +59 -19
  42. package/src/hostd/kakao-renewal-manager.ts +35 -10
  43. package/src/hostd/protocol.ts +2 -0
  44. package/src/hostd/tailscale.ts +41 -5
  45. package/src/hostd/webex-renewal-manager.ts +13 -4
  46. package/src/init/index.ts +50 -1
  47. package/src/init/instagram-auth.ts +134 -0
  48. package/src/init/run-owner-claim.ts +1 -0
  49. package/src/permissions/match-rule.ts +1 -1
  50. package/src/permissions/resolve.ts +1 -0
  51. package/src/plugin/index.ts +1 -0
  52. package/src/plugin/manager.ts +14 -0
  53. package/src/plugin/registry.ts +12 -0
  54. package/src/plugin/types.ts +4 -0
  55. package/src/role-claim/match-rule.ts +2 -1
  56. package/src/run/index.ts +46 -20
  57. package/src/secrets/instagram-store.ts +112 -0
  58. package/src/secrets/schema.ts +18 -0
  59. package/src/skills/typeclaw-channel-instagram/SKILL.md +30 -0
  60. package/src/test-helpers/rm-temp-dir.ts +24 -0
  61. package/typeclaw.schema.json +161 -1
@@ -0,0 +1,24 @@
1
+ import { rm } from 'node:fs/promises'
2
+
3
+ // `Bun.gc(true)` is load-bearing, not suppression: bun:sqlite holds the DB file
4
+ // handle open past `db.close()` until the Statement wrappers are finalized (Bun
5
+ // #25964), and on Windows that open handle pins the dir so `rm` throws EBUSY.
6
+ // The forced GC runs those finalizers. Bun ignores `fs.rm`'s maxRetries, so the
7
+ // loop covers the brief window a sibling worker / just-exited subprocess needs.
8
+ const RETRIES = 10
9
+ const RETRY_DELAY_MS = 50
10
+ const RETRYABLE = new Set(['EBUSY', 'EPERM', 'ENOTEMPTY'])
11
+
12
+ export async function rmTempDir(dir: string): Promise<void> {
13
+ for (let attempt = 0; attempt <= RETRIES; attempt++) {
14
+ Bun.gc(true)
15
+ try {
16
+ await rm(dir, { recursive: true, force: true })
17
+ return
18
+ } catch (err) {
19
+ const code = (err as NodeJS.ErrnoException).code
20
+ if (attempt === RETRIES || code === undefined || !RETRYABLE.has(code)) throw err
21
+ await new Promise((resolve) => setTimeout(resolve, RETRY_DELAY_MS))
22
+ }
23
+ }
24
+ }
@@ -1023,6 +1023,166 @@
1023
1023
  }
1024
1024
  }
1025
1025
  },
1026
+ "instagram": {
1027
+ "type": "object",
1028
+ "properties": {
1029
+ "engagement": {
1030
+ "default": {
1031
+ "trigger": [
1032
+ "mention",
1033
+ "reply",
1034
+ "dm"
1035
+ ],
1036
+ "stickiness": {
1037
+ "perReply": {
1038
+ "window": 900000
1039
+ }
1040
+ }
1041
+ },
1042
+ "type": "object",
1043
+ "properties": {
1044
+ "trigger": {
1045
+ "default": [
1046
+ "mention",
1047
+ "reply",
1048
+ "dm"
1049
+ ],
1050
+ "type": "array",
1051
+ "items": {
1052
+ "type": "string",
1053
+ "enum": [
1054
+ "mention",
1055
+ "reply",
1056
+ "dm"
1057
+ ]
1058
+ }
1059
+ },
1060
+ "stickiness": {
1061
+ "default": {
1062
+ "perReply": {
1063
+ "window": 900000
1064
+ }
1065
+ },
1066
+ "anyOf": [
1067
+ {
1068
+ "type": "string",
1069
+ "const": "off"
1070
+ },
1071
+ {
1072
+ "type": "object",
1073
+ "properties": {
1074
+ "perReply": {
1075
+ "type": "object",
1076
+ "properties": {
1077
+ "window": {
1078
+ "type": "integer",
1079
+ "minimum": 1,
1080
+ "maximum": 86400000
1081
+ }
1082
+ },
1083
+ "required": [
1084
+ "window"
1085
+ ]
1086
+ }
1087
+ },
1088
+ "required": [
1089
+ "perReply"
1090
+ ]
1091
+ }
1092
+ ]
1093
+ }
1094
+ }
1095
+ },
1096
+ "history": {
1097
+ "default": {
1098
+ "prefetch": {
1099
+ "thread": {
1100
+ "head": 3,
1101
+ "tail": 10
1102
+ },
1103
+ "channel": {
1104
+ "tail": 10
1105
+ }
1106
+ }
1107
+ },
1108
+ "type": "object",
1109
+ "properties": {
1110
+ "prefetch": {
1111
+ "default": {
1112
+ "thread": {
1113
+ "head": 3,
1114
+ "tail": 10
1115
+ },
1116
+ "channel": {
1117
+ "tail": 10
1118
+ }
1119
+ },
1120
+ "type": "object",
1121
+ "properties": {
1122
+ "thread": {
1123
+ "default": {
1124
+ "head": 3,
1125
+ "tail": 10
1126
+ },
1127
+ "type": "object",
1128
+ "properties": {
1129
+ "head": {
1130
+ "default": 3,
1131
+ "type": "integer",
1132
+ "minimum": 0,
1133
+ "maximum": 200
1134
+ },
1135
+ "tail": {
1136
+ "default": 10,
1137
+ "type": "integer",
1138
+ "minimum": 0,
1139
+ "maximum": 200
1140
+ }
1141
+ }
1142
+ },
1143
+ "channel": {
1144
+ "default": {
1145
+ "tail": 10
1146
+ },
1147
+ "type": "object",
1148
+ "properties": {
1149
+ "tail": {
1150
+ "default": 10,
1151
+ "type": "integer",
1152
+ "minimum": 0,
1153
+ "maximum": 200
1154
+ }
1155
+ }
1156
+ }
1157
+ }
1158
+ }
1159
+ }
1160
+ },
1161
+ "enabled": {
1162
+ "default": true,
1163
+ "type": "boolean"
1164
+ },
1165
+ "quotedReply": {
1166
+ "default": {
1167
+ "enabled": true,
1168
+ "queueDelayMs": 10000
1169
+ },
1170
+ "type": "object",
1171
+ "properties": {
1172
+ "enabled": {
1173
+ "default": true,
1174
+ "type": "boolean"
1175
+ },
1176
+ "queueDelayMs": {
1177
+ "default": 10000,
1178
+ "type": "integer",
1179
+ "minimum": 0,
1180
+ "maximum": 9007199254740991
1181
+ }
1182
+ }
1183
+ }
1184
+ }
1185
+ },
1026
1186
  "line": {
1027
1187
  "type": "object",
1028
1188
  "properties": {
@@ -2396,7 +2556,7 @@
2396
2556
  "type": "array",
2397
2557
  "items": {
2398
2558
  "type": "string",
2399
- "pattern": "^(tui|cron|subagent(:[a-z][a-z0-9-]*)?|\\*|(slack|discord|telegram|webex|line|kakao|github):[^\\s]+)(\\s+[a-zA-Z][a-zA-Z0-9_]*:[^\\s]+)*$"
2559
+ "pattern": "^(tui|cron|subagent(:[a-z][a-z0-9-]*)?|\\*|(slack|discord|telegram|webex|instagram|line|kakao|github):[^\\s]+)(\\s+[a-zA-Z][a-zA-Z0-9_]*:[^\\s]+)*$"
2400
2560
  }
2401
2561
  },
2402
2562
  "permissions": {