peachsim 0.1.2422 → 0.1.2425

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 (112) hide show
  1. package/cli/command-agent.ts +14 -15
  2. package/cli/commands/box.ts +33 -28
  3. package/cli/commands/canvas.ts +54 -0
  4. package/cli/commands/platform.ts +28 -27
  5. package/cli/commands/preview.ts +2 -1
  6. package/cli/outbound-endpoints.ts +141 -23
  7. package/dist-lib/agent-daemon-client.cjs +1 -1
  8. package/dist-lib/agent-events.cjs +1 -1
  9. package/dist-lib/attached-projects.cjs +1 -1
  10. package/dist-lib/auth/shared-session.cjs +1 -1
  11. package/dist-lib/backend-origin.cjs +1 -1
  12. package/dist-lib/beta.cjs +1 -1
  13. package/dist-lib/beta.mjs +1 -1
  14. package/dist-lib/bridge-constants.cjs +1 -1
  15. package/dist-lib/bridge-contract-input.cjs +1 -1
  16. package/dist-lib/bridge-contract-input.mjs +1 -1
  17. package/dist-lib/bridge-contract.cjs +1 -1
  18. package/dist-lib/bridge-contract.mjs +1 -1
  19. package/dist-lib/bundle-channel.cjs +114 -28
  20. package/dist-lib/capture-contract.cjs +1 -1
  21. package/dist-lib/capture-contract.mjs +1 -1
  22. package/dist-lib/cloud-contract.cjs +22 -1
  23. package/dist-lib/cloud-contract.mjs +20 -1
  24. package/dist-lib/cloud-test-args.cjs +1 -1
  25. package/dist-lib/cloud-test-args.mjs +1 -1
  26. package/dist-lib/cloud.cjs +1 -1
  27. package/dist-lib/cloud.mjs +1 -1
  28. package/dist-lib/config.cjs +1 -1
  29. package/dist-lib/config.mjs +1 -1
  30. package/dist-lib/detox/index.cjs +27 -13
  31. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  32. package/dist-lib/expo-swift-bundle.cjs +112 -26
  33. package/dist-lib/expo-swift-metadata.cjs +1 -1
  34. package/dist-lib/expo-swift-metadata.mjs +1 -1
  35. package/dist-lib/home-paths.cjs +1 -1
  36. package/dist-lib/host/bridge-host.cjs +114 -28
  37. package/dist-lib/host/fetch-proxy-handler.cjs +4 -4
  38. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  39. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  40. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  41. package/dist-lib/host/websocket-proxy.cjs +1 -1
  42. package/dist-lib/index.cjs +88 -59
  43. package/dist-lib/jump-to-source-babel.cjs +1 -1
  44. package/dist-lib/jump-to-source-native.cjs +22 -7
  45. package/dist-lib/kotlin-host.cjs +1 -1
  46. package/dist-lib/menu.cjs +1 -1
  47. package/dist-lib/menu.mjs +1 -1
  48. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  49. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  50. package/dist-lib/metro-production-bundle.cjs +1 -1
  51. package/dist-lib/metro-production-bundle.mjs +1 -1
  52. package/dist-lib/metro.cjs +25 -10
  53. package/dist-lib/native-app-identity-project.cjs +2 -2
  54. package/dist-lib/native-app-identity-project.mjs +2 -2
  55. package/dist-lib/native-app-identity.cjs +1 -1
  56. package/dist-lib/native-app-identity.mjs +1 -1
  57. package/dist-lib/native-firebase-metadata.cjs +1 -1
  58. package/dist-lib/native-firebase-metadata.mjs +1 -1
  59. package/dist-lib/pdfium-raster.cjs +1 -1
  60. package/dist-lib/pdfium-raster.mjs +1 -1
  61. package/dist-lib/plist.cjs +1 -1
  62. package/dist-lib/plist.mjs +1 -1
  63. package/dist-lib/profiles.cjs +1 -1
  64. package/dist-lib/public-brand.cjs +1 -1
  65. package/dist-lib/public-origins-lib-esm.json +24 -24
  66. package/dist-lib/public-origins-lib.json +54 -53
  67. package/dist-lib/react-native-host-modules.cjs +1 -1
  68. package/dist-lib/react-native-host-modules.mjs +1 -1
  69. package/dist-lib/reap-browser.cjs +1 -1
  70. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  71. package/dist-lib/sdk.cjs +1 -1
  72. package/dist-lib/sdk.mjs +1 -1
  73. package/dist-lib/skills.cjs +258 -150
  74. package/dist-lib/swift-compile.cjs +87 -16
  75. package/dist-lib/swift-compile.mjs +87 -16
  76. package/dist-lib/swift-package.cjs +1 -1
  77. package/dist-lib/swift-package.mjs +1 -1
  78. package/dist-lib/swift-submit.cjs +1 -1
  79. package/dist-lib/swift-submit.mjs +1 -1
  80. package/dist-lib/swift-toolchain.cjs +1 -1
  81. package/dist-lib/swift.cjs +1 -1
  82. package/dist-lib/vite-swift.cjs +88 -17
  83. package/dist-lib/vite.cjs +25 -10
  84. package/dist-lib/worklet-executable.cjs +1 -1
  85. package/dist-lib/worklet-executable.mjs +1 -1
  86. package/dist-types/packages/peach-engine/src/ios/apps/canvas-map-data.d.ts +83 -2
  87. package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
  88. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +9 -0
  89. package/dist-types/packages/peach-globals/src/canvasAgentContract.d.ts +8 -0
  90. package/dist-types/packages/peach-globals/src/index.d.ts +4 -2
  91. package/dist-types/packages/peach-globals/src/lockstepCaptureBridgeContract.d.ts +1 -0
  92. package/dist-types/packages/peach-globals/src/replayBridgeContract.d.ts +12 -0
  93. package/dist-types/packages/peach-globals/src/sceneStreamBridgeContract.d.ts +5 -1
  94. package/kotlin/README.md +4 -3
  95. package/kotlin/sdk.tar.gz +0 -0
  96. package/kotlin/toolchain.json +2 -2
  97. package/package.json +1 -1
  98. package/runtime-companion.json +1 -1
  99. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/CoreData.apinotes +2 -0
  100. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStore.h +2 -0
  101. package/sdk/ios/wasm/include/errno.h +10 -0
  102. package/src/agent-daemon-client.ts +1 -1
  103. package/src/agent-prompt.ts +1 -8
  104. package/src/canvas-agent-note-delivery.ts +2 -5
  105. package/src/canvas-groups.ts +11 -3
  106. package/src/cloud-contract.ts +31 -1
  107. package/src/swift-compile.ts +1 -1
  108. package/src/swift-guest-compile.ts +2 -0
  109. package/src/swift-guest-image-ledger.ts +37 -2
  110. package/src/swift-guest-source-inputs.ts +45 -6
  111. package/src/visit-parsed-program.ts +21 -6
  112. package/src/vite-plugin.ts +4 -1
@@ -46,6 +46,26 @@ export function clangIrLinkOptions(ir: string): string[] {
46
46
  // target whose <target>.build directory receives the object
47
47
  export const CLANG_TARGET_MODULE_WRAPPER = '.peach-clang'
48
48
 
49
+ const PARALLEL_REPLAY = `
50
+ const { spawn } = require('node:child_process')
51
+ const commands = JSON.parse(require('node:fs').readFileSync(process.env.PEACH_CLANG_REPLAYS, 'utf8'))
52
+ let next = 0
53
+ const run = () => {
54
+ if (next >= commands.length) return Promise.resolve()
55
+ const [file, ...args] = commands[next++]
56
+ return new Promise((resolve, reject) => {
57
+ const child = spawn(file, args, { stdio: 'inherit' })
58
+ child.on('error', reject)
59
+ child.on('close', (code) => (code === 0 ? resolve() : reject(new Error('clang link replay failed: ' + file))))
60
+ }).then(run)
61
+ }
62
+ const jobs = Math.max(1, Number(process.env.PEACH_CLANG_JOBS) || 1)
63
+ Promise.all(Array.from({ length: jobs }, run)).catch((error) => {
64
+ console.error(error.message)
65
+ process.exit(1)
66
+ })
67
+ `
68
+
49
69
  /** Replay only selected source-owned Clang commands to retain their IR link options. */
50
70
  export function sourceGuestClangLinkOptions(options: {
51
71
  buildDirectory: string
@@ -53,6 +73,7 @@ export function sourceGuestClangLinkOptions(options: {
53
73
  toolchainBin: string
54
74
  swiftCompiler: string
55
75
  objects: readonly string[]
76
+ jobs: number
56
77
  }): Map<string, string[]> {
57
78
  const wanted = new Set(options.objects.map((file) => path.resolve(file)))
58
79
  const commands = new Map<string, { tool: string; args: string[] }>()
@@ -89,7 +110,7 @@ export function sourceGuestClangLinkOptions(options: {
89
110
  commands.set(file, { tool, args: value })
90
111
  }
91
112
  }
92
- const result = new Map<string, string[]>()
113
+ const replays: { file: string; compiler: string; args: string[]; output: string }[] = []
93
114
  for (const [index, file] of [...wanted].entries()) {
94
115
  const command = commands.get(file)
95
116
  if (!command) throw new Error(`missing source object producer ${file}`)
@@ -127,11 +148,29 @@ export function sourceGuestClangLinkOptions(options: {
127
148
  throw new Error(`missing clang ${flag} for ${file}`)
128
149
  args[index + 1] = flag === '-o' ? output : `${output}.d`
129
150
  }
130
- execFileSync(
131
- command.args[0]!,
132
- [...args, '-S', '-emit-llvm', '-Xclang', '-disable-llvm-passes'],
133
- { stdio: 'inherit' },
134
- )
151
+ replays.push({
152
+ file,
153
+ compiler: command.args[0]!,
154
+ args: [...args, '-S', '-emit-llvm', '-Xclang', '-disable-llvm-passes'],
155
+ output,
156
+ })
157
+ }
158
+ // the pruner's plan callback is synchronous, so one child runs the replays concurrently
159
+ const plan = path.join(options.directory, 'clang-link-replays.json')
160
+ writeFileSync(
161
+ plan,
162
+ JSON.stringify(replays.map(({ compiler, args }) => [compiler, ...args])),
163
+ )
164
+ execFileSync(process.execPath, ['-e', PARALLEL_REPLAY], {
165
+ stdio: 'inherit',
166
+ env: {
167
+ ...process.env,
168
+ PEACH_CLANG_REPLAYS: plan,
169
+ PEACH_CLANG_JOBS: String(options.jobs),
170
+ },
171
+ })
172
+ const result = new Map<string, string[]>()
173
+ for (const { file, output } of replays) {
135
174
  const flags = clangIrLinkOptions(readFileSync(output, 'utf8'))
136
175
  for (let index = 0; index < flags.length; index++) {
137
176
  const flag = flags[index]!
@@ -3,19 +3,34 @@ import { isRecord } from './is-record'
3
3
 
4
4
  // traverse the parser's published child keys without runtime-relative module loads.
5
5
  export function visitParsedProgram(program: Program, visitor: VisitorObject): void {
6
+ const enterByType = new Map<string, (node: unknown) => void>()
7
+ const exitByType = new Map<string, (node: unknown) => void>()
8
+ for (const key of Object.keys(visitor)) {
9
+ const handler: unknown = Reflect.get(visitor, key)
10
+ if (typeof handler !== 'function') continue
11
+ const invoke = (node: unknown): void => {
12
+ handler(node)
13
+ }
14
+ if (key.endsWith(':exit')) exitByType.set(key.slice(0, -5), invoke)
15
+ else enterByType.set(key, invoke)
16
+ }
17
+ if (enterByType.size === 0 && exitByType.size === 0) return
18
+ const hasExit = exitByType.size > 0
6
19
  function visit(value: unknown): void {
7
20
  if (Array.isArray(value)) {
8
- for (const child of value) visit(child)
21
+ for (let i = 0; i < value.length; i++) visit(value[i])
9
22
  return
10
23
  }
11
24
  if (!isRecord(value) || typeof value.type !== 'string') return
12
25
  const keys = visitorKeys[value.type]
13
26
  if (!keys) return
14
- const enter: unknown = Reflect.get(visitor, value.type)
15
- if (typeof enter === 'function') enter(value)
16
- for (const key of keys) visit(value[key])
17
- const exit: unknown = Reflect.get(visitor, `${value.type}:exit`)
18
- if (typeof exit === 'function') exit(value)
27
+ const enter = enterByType.get(value.type)
28
+ if (enter) enter(value)
29
+ for (let i = 0; i < keys.length; i++) visit(value[keys[i]!])
30
+ if (hasExit) {
31
+ const exit = exitByType.get(value.type)
32
+ if (exit) exit(value)
33
+ }
19
34
  }
20
35
  visit(program)
21
36
  }
@@ -1615,7 +1615,10 @@ export function wsBridgePlugin(options: { ownedBridgePort?: number } = {}): Plug
1615
1615
  // the native host graph stays outside the config's dependency set.
1616
1616
  // keep jiti's default import interop for commonjs native dependencies.
1617
1617
  const shellPort = { read: readShellPort }
1618
- const host = createJiti(import.meta.url)
1618
+ const jitiCache = fs.existsSync(workspaceNodeModules)
1619
+ ? path.join(workspaceNodeModules, '.cache/jiti')
1620
+ : true
1621
+ const host = createJiti(import.meta.url, { fsCache: jitiCache })
1619
1622
  .import<{ SootSimBridgeHost: typeof SootSimBridgeHost }>(
1620
1623
  fileURLToPath(new URL('./host/bridge-host.ts', import.meta.url)),
1621
1624
  )