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.
Files changed (117) hide show
  1. package/assistant/sessionHistory.ts +87 -0
  2. package/bootstrap/state.ts +1769 -0
  3. package/bridge/bridgeApi.ts +539 -0
  4. package/bridge/bridgeConfig.ts +48 -0
  5. package/bridge/bridgeDebug.ts +135 -0
  6. package/bridge/bridgeEnabled.ts +202 -0
  7. package/bridge/bridgeMain.ts +2999 -0
  8. package/bridge/bridgeMessaging.ts +461 -0
  9. package/bridge/bridgePermissionCallbacks.ts +43 -0
  10. package/bridge/bridgePointer.ts +210 -0
  11. package/bridge/bridgeStatusUtil.ts +163 -0
  12. package/bridge/bridgeUI.ts +530 -0
  13. package/bridge/capacityWake.ts +56 -0
  14. package/bridge/codeSessionApi.ts +168 -0
  15. package/bridge/createSession.ts +384 -0
  16. package/bridge/debugUtils.ts +141 -0
  17. package/bridge/envLessBridgeConfig.ts +165 -0
  18. package/bridge/flushGate.ts +71 -0
  19. package/bridge/inboundAttachments.ts +175 -0
  20. package/bridge/inboundMessages.ts +80 -0
  21. package/bridge/initReplBridge.ts +569 -0
  22. package/bridge/jwtUtils.ts +256 -0
  23. package/bridge/pollConfig.ts +110 -0
  24. package/bridge/pollConfigDefaults.ts +82 -0
  25. package/bridge/remoteBridgeCore.ts +1008 -0
  26. package/bridge/replBridge.ts +2406 -0
  27. package/bridge/replBridgeHandle.ts +36 -0
  28. package/bridge/replBridgeTransport.ts +370 -0
  29. package/bridge/sessionIdCompat.ts +57 -0
  30. package/bridge/sessionRunner.ts +550 -0
  31. package/bridge/trustedDevice.ts +210 -0
  32. package/bridge/types.ts +262 -0
  33. package/bridge/workSecret.ts +127 -0
  34. package/buddy/CompanionSprite.tsx +371 -0
  35. package/buddy/companion.ts +133 -0
  36. package/buddy/prompt.ts +36 -0
  37. package/buddy/sprites.ts +514 -0
  38. package/buddy/types.ts +148 -0
  39. package/buddy/useBuddyNotification.tsx +98 -0
  40. package/coordinator/coordinatorMode.ts +369 -0
  41. package/memdir/findRelevantMemories.ts +141 -0
  42. package/memdir/memdir.ts +507 -0
  43. package/memdir/memoryAge.ts +53 -0
  44. package/memdir/memoryScan.ts +94 -0
  45. package/memdir/memoryTypes.ts +271 -0
  46. package/memdir/paths.ts +278 -0
  47. package/memdir/teamMemPaths.ts +292 -0
  48. package/memdir/teamMemPrompts.ts +100 -0
  49. package/migrations/migrateAutoUpdatesToSettings.ts +61 -0
  50. package/migrations/migrateBypassPermissionsAcceptedToSettings.ts +40 -0
  51. package/migrations/migrateEnableAllProjectMcpServersToSettings.ts +118 -0
  52. package/migrations/migrateFennecToOpus.ts +45 -0
  53. package/migrations/migrateLegacyOpusToCurrent.ts +57 -0
  54. package/migrations/migrateOpusToOpus1m.ts +43 -0
  55. package/migrations/migrateReplBridgeEnabledToRemoteControlAtStartup.ts +22 -0
  56. package/migrations/migrateSonnet1mToSonnet45.ts +48 -0
  57. package/migrations/migrateSonnet45ToSonnet46.ts +67 -0
  58. package/migrations/resetAutoModeOptInForDefaultOffer.ts +51 -0
  59. package/migrations/resetProToOpusDefault.ts +51 -0
  60. package/native-ts/color-diff/index.ts +999 -0
  61. package/native-ts/file-index/index.ts +370 -0
  62. package/native-ts/yoga-layout/enums.ts +134 -0
  63. package/native-ts/yoga-layout/index.ts +2578 -0
  64. package/outputStyles/loadOutputStylesDir.ts +98 -0
  65. package/package.json +22 -5
  66. package/plugins/builtinPlugins.ts +159 -0
  67. package/plugins/bundled/index.ts +23 -0
  68. package/schemas/hooks.ts +222 -0
  69. package/screens/Doctor.tsx +575 -0
  70. package/screens/REPL.tsx +5006 -0
  71. package/screens/ResumeConversation.tsx +399 -0
  72. package/server/createDirectConnectSession.ts +88 -0
  73. package/server/directConnectManager.ts +213 -0
  74. package/server/types.ts +57 -0
  75. package/skills/bundled/batch.ts +124 -0
  76. package/skills/bundled/claudeApi.ts +196 -0
  77. package/skills/bundled/claudeApiContent.ts +75 -0
  78. package/skills/bundled/claudeInChrome.ts +34 -0
  79. package/skills/bundled/debug.ts +103 -0
  80. package/skills/bundled/index.ts +79 -0
  81. package/skills/bundled/keybindings.ts +339 -0
  82. package/skills/bundled/loop.ts +92 -0
  83. package/skills/bundled/loremIpsum.ts +282 -0
  84. package/skills/bundled/remember.ts +82 -0
  85. package/skills/bundled/scheduleRemoteAgents.ts +447 -0
  86. package/skills/bundled/simplify.ts +69 -0
  87. package/skills/bundled/skillify.ts +197 -0
  88. package/skills/bundled/stuck.ts +79 -0
  89. package/skills/bundled/updateConfig.ts +475 -0
  90. package/skills/bundled/verify/SKILL.md +3 -0
  91. package/skills/bundled/verify/examples/cli.md +3 -0
  92. package/skills/bundled/verify/examples/server.md +3 -0
  93. package/skills/bundled/verify.ts +30 -0
  94. package/skills/bundled/verifyContent.ts +13 -0
  95. package/skills/bundledSkills.ts +220 -0
  96. package/skills/loadSkillsDir.ts +1086 -0
  97. package/skills/mcpSkillBuilders.ts +44 -0
  98. package/tasks/DreamTask/DreamTask.ts +157 -0
  99. package/tasks/InProcessTeammateTask/InProcessTeammateTask.tsx +126 -0
  100. package/tasks/InProcessTeammateTask/types.ts +121 -0
  101. package/tasks/LocalAgentTask/LocalAgentTask.tsx +683 -0
  102. package/tasks/LocalMainSessionTask.ts +479 -0
  103. package/tasks/LocalShellTask/LocalShellTask.tsx +523 -0
  104. package/tasks/LocalShellTask/guards.ts +41 -0
  105. package/tasks/LocalShellTask/killShellTasks.ts +76 -0
  106. package/tasks/RemoteAgentTask/RemoteAgentTask.tsx +856 -0
  107. package/tasks/pillLabel.ts +82 -0
  108. package/tasks/stopTask.ts +100 -0
  109. package/tasks/types.ts +46 -0
  110. package/upstreamproxy/relay.ts +455 -0
  111. package/upstreamproxy/upstreamproxy.ts +285 -0
  112. package/vim/motions.ts +82 -0
  113. package/vim/operators.ts +556 -0
  114. package/vim/textObjects.ts +186 -0
  115. package/vim/transitions.ts +490 -0
  116. package/vim/types.ts +199 -0
  117. 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
+ }