yzcode-cli 1.0.2 → 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 +19 -2
- 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,87 @@
|
|
|
1
|
+
import axios from 'axios'
|
|
2
|
+
import { getOauthConfig } from '../constants/oauth.js'
|
|
3
|
+
import type { SDKMessage } from '../entrypoints/agentSdkTypes.js'
|
|
4
|
+
import { logForDebugging } from '../utils/debug.js'
|
|
5
|
+
import { getOAuthHeaders, prepareApiRequest } from '../utils/teleport/api.js'
|
|
6
|
+
|
|
7
|
+
export const HISTORY_PAGE_SIZE = 100
|
|
8
|
+
|
|
9
|
+
export type HistoryPage = {
|
|
10
|
+
/** Chronological order within the page. */
|
|
11
|
+
events: SDKMessage[]
|
|
12
|
+
/** Oldest event ID in this page → before_id cursor for next-older page. */
|
|
13
|
+
firstId: string | null
|
|
14
|
+
/** true = older events exist. */
|
|
15
|
+
hasMore: boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type SessionEventsResponse = {
|
|
19
|
+
data: SDKMessage[]
|
|
20
|
+
has_more: boolean
|
|
21
|
+
first_id: string | null
|
|
22
|
+
last_id: string | null
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type HistoryAuthCtx = {
|
|
26
|
+
baseUrl: string
|
|
27
|
+
headers: Record<string, string>
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Prepare auth + headers + base URL once, reuse across pages. */
|
|
31
|
+
export async function createHistoryAuthCtx(
|
|
32
|
+
sessionId: string,
|
|
33
|
+
): Promise<HistoryAuthCtx> {
|
|
34
|
+
const { accessToken, orgUUID } = await prepareApiRequest()
|
|
35
|
+
return {
|
|
36
|
+
baseUrl: `${getOauthConfig().BASE_API_URL}/v1/sessions/${sessionId}/events`,
|
|
37
|
+
headers: {
|
|
38
|
+
...getOAuthHeaders(accessToken),
|
|
39
|
+
'anthropic-beta': 'ccr-byoc-2025-07-29',
|
|
40
|
+
'x-organization-uuid': orgUUID,
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async function fetchPage(
|
|
46
|
+
ctx: HistoryAuthCtx,
|
|
47
|
+
params: Record<string, string | number | boolean>,
|
|
48
|
+
label: string,
|
|
49
|
+
): Promise<HistoryPage | null> {
|
|
50
|
+
const resp = await axios
|
|
51
|
+
.get<SessionEventsResponse>(ctx.baseUrl, {
|
|
52
|
+
headers: ctx.headers,
|
|
53
|
+
params,
|
|
54
|
+
timeout: 15000,
|
|
55
|
+
validateStatus: () => true,
|
|
56
|
+
})
|
|
57
|
+
.catch(() => null)
|
|
58
|
+
if (!resp || resp.status !== 200) {
|
|
59
|
+
logForDebugging(`[${label}] HTTP ${resp?.status ?? 'error'}`)
|
|
60
|
+
return null
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
events: Array.isArray(resp.data.data) ? resp.data.data : [],
|
|
64
|
+
firstId: resp.data.first_id,
|
|
65
|
+
hasMore: resp.data.has_more,
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Newest page: last `limit` events, chronological, via anchor_to_latest.
|
|
71
|
+
* has_more=true means older events exist.
|
|
72
|
+
*/
|
|
73
|
+
export async function fetchLatestEvents(
|
|
74
|
+
ctx: HistoryAuthCtx,
|
|
75
|
+
limit = HISTORY_PAGE_SIZE,
|
|
76
|
+
): Promise<HistoryPage | null> {
|
|
77
|
+
return fetchPage(ctx, { limit, anchor_to_latest: true }, 'fetchLatestEvents')
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Older page: events immediately before `beforeId` cursor. */
|
|
81
|
+
export async function fetchOlderEvents(
|
|
82
|
+
ctx: HistoryAuthCtx,
|
|
83
|
+
beforeId: string,
|
|
84
|
+
limit = HISTORY_PAGE_SIZE,
|
|
85
|
+
): Promise<HistoryPage | null> {
|
|
86
|
+
return fetchPage(ctx, { limit, before_id: beforeId }, 'fetchOlderEvents')
|
|
87
|
+
}
|