yzcode-cli 1.0.1 → 1.0.3
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/assistant/sessionHistory.ts +87 -0
- package/bootstrap/state.ts +1769 -0
- package/bridge/bridgeApi.ts +539 -0
- package/bridge/bridgeConfig.ts +48 -0
- package/bridge/bridgeDebug.ts +135 -0
- package/bridge/bridgeEnabled.ts +202 -0
- package/bridge/bridgeMain.ts +2999 -0
- package/bridge/bridgeMessaging.ts +461 -0
- package/bridge/bridgePermissionCallbacks.ts +43 -0
- package/bridge/bridgePointer.ts +210 -0
- package/bridge/bridgeStatusUtil.ts +163 -0
- package/bridge/bridgeUI.ts +530 -0
- package/bridge/capacityWake.ts +56 -0
- package/bridge/codeSessionApi.ts +168 -0
- package/bridge/createSession.ts +384 -0
- package/bridge/debugUtils.ts +141 -0
- package/bridge/envLessBridgeConfig.ts +165 -0
- package/bridge/flushGate.ts +71 -0
- package/bridge/inboundAttachments.ts +175 -0
- package/bridge/inboundMessages.ts +80 -0
- package/bridge/initReplBridge.ts +569 -0
- package/bridge/jwtUtils.ts +256 -0
- package/bridge/pollConfig.ts +110 -0
- package/bridge/pollConfigDefaults.ts +82 -0
- package/bridge/remoteBridgeCore.ts +1008 -0
- package/bridge/replBridge.ts +2406 -0
- package/bridge/replBridgeHandle.ts +36 -0
- package/bridge/replBridgeTransport.ts +370 -0
- package/bridge/sessionIdCompat.ts +57 -0
- package/bridge/sessionRunner.ts +550 -0
- package/bridge/trustedDevice.ts +210 -0
- package/bridge/types.ts +262 -0
- package/bridge/workSecret.ts +127 -0
- package/buddy/CompanionSprite.tsx +371 -0
- package/buddy/companion.ts +133 -0
- package/buddy/prompt.ts +36 -0
- package/buddy/sprites.ts +514 -0
- package/buddy/types.ts +148 -0
- package/buddy/useBuddyNotification.tsx +98 -0
- package/coordinator/coordinatorMode.ts +369 -0
- package/memdir/findRelevantMemories.ts +141 -0
- package/memdir/memdir.ts +507 -0
- package/memdir/memoryAge.ts +53 -0
- package/memdir/memoryScan.ts +94 -0
- package/memdir/memoryTypes.ts +271 -0
- package/memdir/paths.ts +278 -0
- package/memdir/teamMemPaths.ts +292 -0
- package/memdir/teamMemPrompts.ts +100 -0
- package/migrations/migrateAutoUpdatesToSettings.ts +61 -0
- package/migrations/migrateBypassPermissionsAcceptedToSettings.ts +40 -0
- package/migrations/migrateEnableAllProjectMcpServersToSettings.ts +118 -0
- package/migrations/migrateFennecToOpus.ts +45 -0
- package/migrations/migrateLegacyOpusToCurrent.ts +57 -0
- package/migrations/migrateOpusToOpus1m.ts +43 -0
- package/migrations/migrateReplBridgeEnabledToRemoteControlAtStartup.ts +22 -0
- package/migrations/migrateSonnet1mToSonnet45.ts +48 -0
- package/migrations/migrateSonnet45ToSonnet46.ts +67 -0
- package/migrations/resetAutoModeOptInForDefaultOffer.ts +51 -0
- package/migrations/resetProToOpusDefault.ts +51 -0
- package/native-ts/color-diff/index.ts +999 -0
- package/native-ts/file-index/index.ts +370 -0
- package/native-ts/yoga-layout/enums.ts +134 -0
- package/native-ts/yoga-layout/index.ts +2578 -0
- package/outputStyles/loadOutputStylesDir.ts +98 -0
- package/package.json +22 -5
- package/plugins/builtinPlugins.ts +159 -0
- package/plugins/bundled/index.ts +23 -0
- package/schemas/hooks.ts +222 -0
- package/screens/Doctor.tsx +575 -0
- package/screens/REPL.tsx +5006 -0
- package/screens/ResumeConversation.tsx +399 -0
- package/server/createDirectConnectSession.ts +88 -0
- package/server/directConnectManager.ts +213 -0
- package/server/types.ts +57 -0
- package/skills/bundled/batch.ts +124 -0
- package/skills/bundled/claudeApi.ts +196 -0
- package/skills/bundled/claudeApiContent.ts +75 -0
- package/skills/bundled/claudeInChrome.ts +34 -0
- package/skills/bundled/debug.ts +103 -0
- package/skills/bundled/index.ts +79 -0
- package/skills/bundled/keybindings.ts +339 -0
- package/skills/bundled/loop.ts +92 -0
- package/skills/bundled/loremIpsum.ts +282 -0
- package/skills/bundled/remember.ts +82 -0
- package/skills/bundled/scheduleRemoteAgents.ts +447 -0
- package/skills/bundled/simplify.ts +69 -0
- package/skills/bundled/skillify.ts +197 -0
- package/skills/bundled/stuck.ts +79 -0
- package/skills/bundled/updateConfig.ts +475 -0
- package/skills/bundled/verify/SKILL.md +3 -0
- package/skills/bundled/verify/examples/cli.md +3 -0
- package/skills/bundled/verify/examples/server.md +3 -0
- package/skills/bundled/verify.ts +30 -0
- package/skills/bundled/verifyContent.ts +13 -0
- package/skills/bundledSkills.ts +220 -0
- package/skills/loadSkillsDir.ts +1086 -0
- package/skills/mcpSkillBuilders.ts +44 -0
- package/tasks/DreamTask/DreamTask.ts +157 -0
- package/tasks/InProcessTeammateTask/InProcessTeammateTask.tsx +126 -0
- package/tasks/InProcessTeammateTask/types.ts +121 -0
- package/tasks/LocalAgentTask/LocalAgentTask.tsx +683 -0
- package/tasks/LocalMainSessionTask.ts +479 -0
- package/tasks/LocalShellTask/LocalShellTask.tsx +523 -0
- package/tasks/LocalShellTask/guards.ts +41 -0
- package/tasks/LocalShellTask/killShellTasks.ts +76 -0
- package/tasks/RemoteAgentTask/RemoteAgentTask.tsx +856 -0
- package/tasks/pillLabel.ts +82 -0
- package/tasks/stopTask.ts +100 -0
- package/tasks/types.ts +46 -0
- package/upstreamproxy/relay.ts +455 -0
- package/upstreamproxy/upstreamproxy.ts +285 -0
- package/vim/motions.ts +82 -0
- package/vim/operators.ts +556 -0
- package/vim/textObjects.ts +186 -0
- package/vim/transitions.ts +490 -0
- package/vim/types.ts +199 -0
- package/voice/voiceModeEnabled.ts +54 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { registerBundledSkill } from '../bundledSkills.js'
|
|
2
|
+
|
|
3
|
+
// Verified 1-token words (tested via API token counting)
|
|
4
|
+
// All common English words confirmed to tokenize as single tokens
|
|
5
|
+
const ONE_TOKEN_WORDS = [
|
|
6
|
+
// Articles & pronouns
|
|
7
|
+
'the',
|
|
8
|
+
'a',
|
|
9
|
+
'an',
|
|
10
|
+
'I',
|
|
11
|
+
'you',
|
|
12
|
+
'he',
|
|
13
|
+
'she',
|
|
14
|
+
'it',
|
|
15
|
+
'we',
|
|
16
|
+
'they',
|
|
17
|
+
'me',
|
|
18
|
+
'him',
|
|
19
|
+
'her',
|
|
20
|
+
'us',
|
|
21
|
+
'them',
|
|
22
|
+
'my',
|
|
23
|
+
'your',
|
|
24
|
+
'his',
|
|
25
|
+
'its',
|
|
26
|
+
'our',
|
|
27
|
+
'this',
|
|
28
|
+
'that',
|
|
29
|
+
'what',
|
|
30
|
+
'who',
|
|
31
|
+
// Common verbs
|
|
32
|
+
'is',
|
|
33
|
+
'are',
|
|
34
|
+
'was',
|
|
35
|
+
'were',
|
|
36
|
+
'be',
|
|
37
|
+
'been',
|
|
38
|
+
'have',
|
|
39
|
+
'has',
|
|
40
|
+
'had',
|
|
41
|
+
'do',
|
|
42
|
+
'does',
|
|
43
|
+
'did',
|
|
44
|
+
'will',
|
|
45
|
+
'would',
|
|
46
|
+
'can',
|
|
47
|
+
'could',
|
|
48
|
+
'may',
|
|
49
|
+
'might',
|
|
50
|
+
'must',
|
|
51
|
+
'shall',
|
|
52
|
+
'should',
|
|
53
|
+
'make',
|
|
54
|
+
'made',
|
|
55
|
+
'get',
|
|
56
|
+
'got',
|
|
57
|
+
'go',
|
|
58
|
+
'went',
|
|
59
|
+
'come',
|
|
60
|
+
'came',
|
|
61
|
+
'see',
|
|
62
|
+
'saw',
|
|
63
|
+
'know',
|
|
64
|
+
'take',
|
|
65
|
+
'think',
|
|
66
|
+
'look',
|
|
67
|
+
'want',
|
|
68
|
+
'use',
|
|
69
|
+
'find',
|
|
70
|
+
'give',
|
|
71
|
+
'tell',
|
|
72
|
+
'work',
|
|
73
|
+
'call',
|
|
74
|
+
'try',
|
|
75
|
+
'ask',
|
|
76
|
+
'need',
|
|
77
|
+
'feel',
|
|
78
|
+
'seem',
|
|
79
|
+
'leave',
|
|
80
|
+
'put',
|
|
81
|
+
// Common nouns & adjectives
|
|
82
|
+
'time',
|
|
83
|
+
'year',
|
|
84
|
+
'day',
|
|
85
|
+
'way',
|
|
86
|
+
'man',
|
|
87
|
+
'thing',
|
|
88
|
+
'life',
|
|
89
|
+
'hand',
|
|
90
|
+
'part',
|
|
91
|
+
'place',
|
|
92
|
+
'case',
|
|
93
|
+
'point',
|
|
94
|
+
'fact',
|
|
95
|
+
'good',
|
|
96
|
+
'new',
|
|
97
|
+
'first',
|
|
98
|
+
'last',
|
|
99
|
+
'long',
|
|
100
|
+
'great',
|
|
101
|
+
'little',
|
|
102
|
+
'own',
|
|
103
|
+
'other',
|
|
104
|
+
'old',
|
|
105
|
+
'right',
|
|
106
|
+
'big',
|
|
107
|
+
'high',
|
|
108
|
+
'small',
|
|
109
|
+
'large',
|
|
110
|
+
'next',
|
|
111
|
+
'early',
|
|
112
|
+
'young',
|
|
113
|
+
'few',
|
|
114
|
+
'public',
|
|
115
|
+
'bad',
|
|
116
|
+
'same',
|
|
117
|
+
'able',
|
|
118
|
+
// Prepositions & conjunctions
|
|
119
|
+
'in',
|
|
120
|
+
'on',
|
|
121
|
+
'at',
|
|
122
|
+
'to',
|
|
123
|
+
'for',
|
|
124
|
+
'of',
|
|
125
|
+
'with',
|
|
126
|
+
'from',
|
|
127
|
+
'by',
|
|
128
|
+
'about',
|
|
129
|
+
'like',
|
|
130
|
+
'through',
|
|
131
|
+
'over',
|
|
132
|
+
'before',
|
|
133
|
+
'between',
|
|
134
|
+
'under',
|
|
135
|
+
'since',
|
|
136
|
+
'without',
|
|
137
|
+
'and',
|
|
138
|
+
'or',
|
|
139
|
+
'but',
|
|
140
|
+
'if',
|
|
141
|
+
'than',
|
|
142
|
+
'because',
|
|
143
|
+
'as',
|
|
144
|
+
'until',
|
|
145
|
+
'while',
|
|
146
|
+
'so',
|
|
147
|
+
'though',
|
|
148
|
+
'both',
|
|
149
|
+
'each',
|
|
150
|
+
'when',
|
|
151
|
+
'where',
|
|
152
|
+
'why',
|
|
153
|
+
'how',
|
|
154
|
+
// Common adverbs
|
|
155
|
+
'not',
|
|
156
|
+
'now',
|
|
157
|
+
'just',
|
|
158
|
+
'more',
|
|
159
|
+
'also',
|
|
160
|
+
'here',
|
|
161
|
+
'there',
|
|
162
|
+
'then',
|
|
163
|
+
'only',
|
|
164
|
+
'very',
|
|
165
|
+
'well',
|
|
166
|
+
'back',
|
|
167
|
+
'still',
|
|
168
|
+
'even',
|
|
169
|
+
'much',
|
|
170
|
+
'too',
|
|
171
|
+
'such',
|
|
172
|
+
'never',
|
|
173
|
+
'again',
|
|
174
|
+
'most',
|
|
175
|
+
'once',
|
|
176
|
+
'off',
|
|
177
|
+
'away',
|
|
178
|
+
'down',
|
|
179
|
+
'out',
|
|
180
|
+
'up',
|
|
181
|
+
// Tech/common words
|
|
182
|
+
'test',
|
|
183
|
+
'code',
|
|
184
|
+
'data',
|
|
185
|
+
'file',
|
|
186
|
+
'line',
|
|
187
|
+
'text',
|
|
188
|
+
'word',
|
|
189
|
+
'number',
|
|
190
|
+
'system',
|
|
191
|
+
'program',
|
|
192
|
+
'set',
|
|
193
|
+
'run',
|
|
194
|
+
'value',
|
|
195
|
+
'name',
|
|
196
|
+
'type',
|
|
197
|
+
'state',
|
|
198
|
+
'end',
|
|
199
|
+
'start',
|
|
200
|
+
]
|
|
201
|
+
|
|
202
|
+
function generateLoremIpsum(targetTokens: number): string {
|
|
203
|
+
let tokens = 0
|
|
204
|
+
let result = ''
|
|
205
|
+
|
|
206
|
+
while (tokens < targetTokens) {
|
|
207
|
+
// Sentence: 10-20 words
|
|
208
|
+
const sentenceLength = 10 + Math.floor(Math.random() * 11)
|
|
209
|
+
let wordsInSentence = 0
|
|
210
|
+
|
|
211
|
+
for (let i = 0; i < sentenceLength && tokens < targetTokens; i++) {
|
|
212
|
+
const word =
|
|
213
|
+
ONE_TOKEN_WORDS[Math.floor(Math.random() * ONE_TOKEN_WORDS.length)]
|
|
214
|
+
result += word
|
|
215
|
+
tokens++
|
|
216
|
+
wordsInSentence++
|
|
217
|
+
|
|
218
|
+
if (i === sentenceLength - 1 || tokens >= targetTokens) {
|
|
219
|
+
result += '. '
|
|
220
|
+
} else {
|
|
221
|
+
result += ' '
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Paragraph break every 5-8 sentences (roughly 20% chance per sentence)
|
|
226
|
+
if (wordsInSentence > 0 && Math.random() < 0.2 && tokens < targetTokens) {
|
|
227
|
+
result += '\n\n'
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return result.trim()
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export function registerLoremIpsumSkill(): void {
|
|
235
|
+
if (process.env.USER_TYPE !== 'ant') {
|
|
236
|
+
return
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
registerBundledSkill({
|
|
240
|
+
name: 'lorem-ipsum',
|
|
241
|
+
description:
|
|
242
|
+
'Generate filler text for long context testing. Specify token count as argument (e.g., /lorem-ipsum 50000). Outputs approximately the requested number of tokens. Ant-only.',
|
|
243
|
+
argumentHint: '[token_count]',
|
|
244
|
+
userInvocable: true,
|
|
245
|
+
async getPromptForCommand(args) {
|
|
246
|
+
const parsed = parseInt(args)
|
|
247
|
+
|
|
248
|
+
if (args && (isNaN(parsed) || parsed <= 0)) {
|
|
249
|
+
return [
|
|
250
|
+
{
|
|
251
|
+
type: 'text',
|
|
252
|
+
text: 'Invalid token count. Please provide a positive number (e.g., /lorem-ipsum 10000).',
|
|
253
|
+
},
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const targetTokens = parsed || 10000
|
|
258
|
+
|
|
259
|
+
// Cap at 500k tokens for safety
|
|
260
|
+
const cappedTokens = Math.min(targetTokens, 500_000)
|
|
261
|
+
|
|
262
|
+
if (cappedTokens < targetTokens) {
|
|
263
|
+
return [
|
|
264
|
+
{
|
|
265
|
+
type: 'text',
|
|
266
|
+
text: `Requested ${targetTokens} tokens, but capped at 500,000 for safety.\n\n${generateLoremIpsum(cappedTokens)}`,
|
|
267
|
+
},
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const loremText = generateLoremIpsum(cappedTokens)
|
|
272
|
+
|
|
273
|
+
// Just dump the lorem ipsum text into the conversation
|
|
274
|
+
return [
|
|
275
|
+
{
|
|
276
|
+
type: 'text',
|
|
277
|
+
text: loremText,
|
|
278
|
+
},
|
|
279
|
+
]
|
|
280
|
+
},
|
|
281
|
+
})
|
|
282
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { isAutoMemoryEnabled } from '../../memdir/paths.js'
|
|
2
|
+
import { registerBundledSkill } from '../bundledSkills.js'
|
|
3
|
+
|
|
4
|
+
export function registerRememberSkill(): void {
|
|
5
|
+
if (process.env.USER_TYPE !== 'ant') {
|
|
6
|
+
return
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const SKILL_PROMPT = `# Memory Review
|
|
10
|
+
|
|
11
|
+
## Goal
|
|
12
|
+
Review the user's memory landscape and produce a clear report of proposed changes, grouped by action type. Do NOT apply changes — present proposals for user approval.
|
|
13
|
+
|
|
14
|
+
## Steps
|
|
15
|
+
|
|
16
|
+
### 1. Gather all memory layers
|
|
17
|
+
Read CLAUDE.md and CLAUDE.local.md from the project root (if they exist). Your auto-memory content is already in your system prompt — review it there. Note which team memory sections exist, if any.
|
|
18
|
+
|
|
19
|
+
**Success criteria**: You have the contents of all memory layers and can compare them.
|
|
20
|
+
|
|
21
|
+
### 2. Classify each auto-memory entry
|
|
22
|
+
For each substantive entry in auto-memory, determine the best destination:
|
|
23
|
+
|
|
24
|
+
| Destination | What belongs there | Examples |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| **CLAUDE.md** | Project conventions and instructions for Claude that all contributors should follow | "use bun not npm", "API routes use kebab-case", "test command is bun test", "prefer functional style" |
|
|
27
|
+
| **CLAUDE.local.md** | Personal instructions for Claude specific to this user, not applicable to other contributors | "I prefer concise responses", "always explain trade-offs", "don't auto-commit", "run tests before committing" |
|
|
28
|
+
| **Team memory** | Org-wide knowledge that applies across repositories (only if team memory is configured) | "deploy PRs go through #deploy-queue", "staging is at staging.internal", "platform team owns infra" |
|
|
29
|
+
| **Stay in auto-memory** | Working notes, temporary context, or entries that don't clearly fit elsewhere | Session-specific observations, uncertain patterns |
|
|
30
|
+
|
|
31
|
+
**Important distinctions:**
|
|
32
|
+
- CLAUDE.md and CLAUDE.local.md contain instructions for Claude, not user preferences for external tools (editor theme, IDE keybindings, etc. don't belong in either)
|
|
33
|
+
- Workflow practices (PR conventions, merge strategies, branch naming) are ambiguous — ask the user whether they're personal or team-wide
|
|
34
|
+
- When unsure, ask rather than guess
|
|
35
|
+
|
|
36
|
+
**Success criteria**: Each entry has a proposed destination or is flagged as ambiguous.
|
|
37
|
+
|
|
38
|
+
### 3. Identify cleanup opportunities
|
|
39
|
+
Scan across all layers for:
|
|
40
|
+
- **Duplicates**: Auto-memory entries already captured in CLAUDE.md or CLAUDE.local.md → propose removing from auto-memory
|
|
41
|
+
- **Outdated**: CLAUDE.md or CLAUDE.local.md entries contradicted by newer auto-memory entries → propose updating the older layer
|
|
42
|
+
- **Conflicts**: Contradictions between any two layers → propose resolution, noting which is more recent
|
|
43
|
+
|
|
44
|
+
**Success criteria**: All cross-layer issues identified.
|
|
45
|
+
|
|
46
|
+
### 4. Present the report
|
|
47
|
+
Output a structured report grouped by action type:
|
|
48
|
+
1. **Promotions** — entries to move, with destination and rationale
|
|
49
|
+
2. **Cleanup** — duplicates, outdated entries, conflicts to resolve
|
|
50
|
+
3. **Ambiguous** — entries where you need the user's input on destination
|
|
51
|
+
4. **No action needed** — brief note on entries that should stay put
|
|
52
|
+
|
|
53
|
+
If auto-memory is empty, say so and offer to review CLAUDE.md for cleanup.
|
|
54
|
+
|
|
55
|
+
**Success criteria**: User can review and approve/reject each proposal individually.
|
|
56
|
+
|
|
57
|
+
## Rules
|
|
58
|
+
- Present ALL proposals before making any changes
|
|
59
|
+
- Do NOT modify files without explicit user approval
|
|
60
|
+
- Do NOT create new files unless the target doesn't exist yet
|
|
61
|
+
- Ask about ambiguous entries — don't guess
|
|
62
|
+
`
|
|
63
|
+
|
|
64
|
+
registerBundledSkill({
|
|
65
|
+
name: 'remember',
|
|
66
|
+
description:
|
|
67
|
+
'Review auto-memory entries and propose promotions to CLAUDE.md, CLAUDE.local.md, or shared memory. Also detects outdated, conflicting, and duplicate entries across memory layers.',
|
|
68
|
+
whenToUse:
|
|
69
|
+
'Use when the user wants to review, organize, or promote their auto-memory entries. Also useful for cleaning up outdated or conflicting entries across CLAUDE.md, CLAUDE.local.md, and auto-memory.',
|
|
70
|
+
userInvocable: true,
|
|
71
|
+
isEnabled: () => isAutoMemoryEnabled(),
|
|
72
|
+
async getPromptForCommand(args) {
|
|
73
|
+
let prompt = SKILL_PROMPT
|
|
74
|
+
|
|
75
|
+
if (args) {
|
|
76
|
+
prompt += `\n## Additional context from user\n\n${args}`
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return [{ type: 'text', text: prompt }]
|
|
80
|
+
},
|
|
81
|
+
})
|
|
82
|
+
}
|