peachsim 0.1.2406 → 0.1.2408

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 (96) hide show
  1. package/cli/agent-note.ts +231 -0
  2. package/cli/cloud-dispatch.ts +1 -1
  3. package/cli/commands/agent.ts +29 -26
  4. package/cli/commands/stream.ts +11 -7
  5. package/cli/main.ts +16 -2
  6. package/cli/outbound-endpoints.ts +15 -0
  7. package/dist-lib/agent-daemon-client.cjs +23 -3
  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 +201 -60
  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 +1 -1
  23. package/dist-lib/cloud-contract.mjs +1 -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 +1 -1
  31. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  32. package/dist-lib/expo-swift-bundle.cjs +200 -59
  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 +356 -100
  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 +4 -4
  43. package/dist-lib/jump-to-source-babel.cjs +1 -1
  44. package/dist-lib/jump-to-source-native.cjs +1 -1
  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 +4 -4
  53. package/dist-lib/native-app-identity-project.cjs +3 -3
  54. package/dist-lib/native-app-identity-project.mjs +3 -3
  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 +56 -55
  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 +367 -106
  74. package/dist-lib/swift-compile.cjs +195 -54
  75. package/dist-lib/swift-compile.mjs +195 -54
  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 +198 -57
  83. package/dist-lib/vite.cjs +4 -4
  84. package/dist-lib/worklet-executable.cjs +1 -1
  85. package/dist-lib/worklet-executable.mjs +1 -1
  86. package/kotlin/sdk.tar.gz +0 -0
  87. package/package.json +1 -1
  88. package/skills/peach-setup/SKILL.md +8 -3
  89. package/src/agent-daemon-client.ts +35 -2
  90. package/src/agent-prompt.ts +68 -0
  91. package/src/canvas-agent-note-delivery.ts +83 -0
  92. package/src/host/agent-host.ts +128 -18
  93. package/src/swift-compile.ts +124 -66
  94. package/src/swift-host.ts +2 -1
  95. package/src/swift-objc-import.ts +99 -0
  96. package/src/xcode-header-search.ts +33 -0
@@ -24,6 +24,105 @@ export function swiftClangImporterFlags(flags: readonly string[]): string[] {
24
24
  )
25
25
  }
26
26
 
27
+ const CLANG_PATH_OPTIONS = new Set([
28
+ '-I',
29
+ '-F',
30
+ '-idirafter',
31
+ '-iframework',
32
+ '-iframeworkwithsysroot',
33
+ '-imacros',
34
+ '-include',
35
+ '-iprefix',
36
+ '-iquote',
37
+ '-isystem',
38
+ '-isysroot',
39
+ '-ivfsoverlay',
40
+ '-iwithprefix',
41
+ '-iwithprefixbefore',
42
+ '--sysroot',
43
+ ])
44
+
45
+ export function compactSwiftClangDefines(flags: string[]): string[] {
46
+ const definitions = new Map<string, string | null>()
47
+ const macros: { index: number; name: string; flag: string }[] = []
48
+ for (let index = 0; index < flags.length; index++) {
49
+ if (flags[index]!.startsWith('@')) return flags
50
+ if (flags[index] !== '-Xcc') continue
51
+ const flag = flags[++index]
52
+ if (
53
+ flag === undefined ||
54
+ flags[index - 2] === '-Xfrontend' ||
55
+ flag === '-Xclang' ||
56
+ flag === '-Xpreprocessor' ||
57
+ flag.startsWith('-Wp,') ||
58
+ flag.startsWith('--config') ||
59
+ flag.startsWith('@')
60
+ )
61
+ return flags
62
+ if (CLANG_PATH_OPTIONS.has(flag) && flags[index + 1] === '-Xcc') {
63
+ index += 2
64
+ continue
65
+ }
66
+ if (!flag.startsWith('-D') && !flag.startsWith('-U')) continue
67
+ const name = /^-[DU]([A-Za-z_$][\w$]*)(?=[(=]|$)/.exec(flag)?.[1]
68
+ if (!name) return flags
69
+ const previous = definitions.get(name)
70
+ definitions.set(name, previous === undefined || previous === flag ? flag : null)
71
+ macros.push({ index, name, flag })
72
+ }
73
+ // clang hashes repeated preprocessor options even when they define the same macro.
74
+ const seen = new Set<string>()
75
+ const duplicates = new Set<number>()
76
+ for (const { index, name, flag } of macros) {
77
+ if (definitions.get(name) !== flag) continue
78
+ if (seen.has(name)) {
79
+ duplicates.add(index - 1)
80
+ duplicates.add(index)
81
+ }
82
+ seen.add(name)
83
+ }
84
+ return duplicates.size === 0
85
+ ? flags
86
+ : flags.filter((_, index) => !duplicates.has(index))
87
+ }
88
+
89
+ export function compactSwiftClangOverlays(
90
+ flags: string[],
91
+ generated: ReadonlySet<string>,
92
+ ): string[] {
93
+ if (generated.size === 0) return flags
94
+ const overlays = new Map<string, number>()
95
+ const duplicates = new Set<number>()
96
+ for (let index = 0; index < flags.length; index++) {
97
+ const flag = flags[index]!
98
+ if (flag.startsWith('@')) return flags
99
+ if (flag === '-Xcc' && flags[index - 1] === '-Xfrontend') return flags
100
+ if (
101
+ flags[index - 1] === '-Xcc' &&
102
+ (flag.startsWith('--config') || flag === '-Xclang')
103
+ )
104
+ return flags
105
+ if (!flag.startsWith('-ivfsoverlay') && !flag.startsWith('-vfsoverlay')) continue
106
+ if (
107
+ flag !== '-ivfsoverlay' ||
108
+ flags[index - 1] !== '-Xcc' ||
109
+ flags[index + 1] !== '-Xcc'
110
+ )
111
+ return flags
112
+ const file = flags[index + 2]
113
+ if (file === undefined || !generated.has(file)) return flags
114
+ const previous = overlays.get(file)
115
+ // later clang overlays take precedence.
116
+ if (previous !== undefined)
117
+ for (let offset = -1; offset < 3; offset++) duplicates.add(previous + offset)
118
+ overlays.set(file, index)
119
+ index += 2
120
+ }
121
+ return duplicates.size === 0
122
+ ? flags
123
+ : flags.filter((_, index) => !duplicates.has(index))
124
+ }
125
+
27
126
  // swift names a header's submodule as `import Module.Header`, which xcode
28
127
  // infers for every header of a framework. a header an app source imports that
29
128
  // way becomes its own submodule, visible with the module; the rest stay in it.
@@ -8,6 +8,39 @@ import { caseInsensitiveHeaderOverlay } from './case-insensitive-header-overlay'
8
8
  import { writeBuildFile } from './write-build-file'
9
9
  import type { SwiftNativeHeaderMap } from './swiftContract'
10
10
 
11
+ type OverlayEntry =
12
+ | { name: string; type: 'directory'; contents: OverlayEntry[] }
13
+ | { name: string; type: 'file'; 'external-contents': string }
14
+
15
+ export function coalescibleHeaderOverlays(
16
+ files: ReadonlySet<string>,
17
+ ): ReadonlySet<string> {
18
+ const aliases = new Map<string, string>()
19
+ const key = (file: string) => file.replace(/[A-Z]/g, (letter) => letter.toLowerCase())
20
+ const index = (directory: string, entry: OverlayEntry): boolean => {
21
+ const name = path.resolve(directory, entry.name)
22
+ if (entry.type === 'directory')
23
+ return entry.contents.every((child) => index(name, child))
24
+ const source = entry['external-contents']
25
+ const previous = aliases.get(key(name))
26
+ if (previous !== undefined && previous !== source) return false
27
+ aliases.set(key(name), source)
28
+ return true
29
+ }
30
+ for (const file of files) {
31
+ const overlay: { roots: OverlayEntry[] } = JSON.parse(fs.readFileSync(file, 'utf8'))
32
+ if (!overlay.roots.every((entry) => index(path.dirname(file), entry)))
33
+ return new Set()
34
+ }
35
+ // removing duplicate layers preserves lookup only when the overlays share
36
+ // mappings and their real files cannot redirect through another layer.
37
+ for (const file of [...files, ...aliases.values()]) {
38
+ const source = aliases.get(key(path.normalize(file)))
39
+ if (source !== undefined && source !== file) return new Set()
40
+ }
41
+ return files
42
+ }
43
+
11
44
  // clang's header map format: case-insensitive keys hashed into a power-of-two
12
45
  // bucket table, each value split into a prefix and suffix string.
13
46
  function headerMap(entries: readonly (readonly [string, string])[]): Buffer {