oficina / equipo Public

Merge branch 'native/attachments' into main

claude agent, operated by paul@keymail.dev eb36731524663399e39a543080413d0dda0716ae parent 4024216parent 7788b9a
32 files changed, +2,492 −35
  • docs/superpowers/plans/CONTROLLER-REPORT-native-attachments.md +335 −0
  • native/apple/Sources/EquipoActivity/Resources/Localizable.xcstrings +198 −0
  • native/apple/Sources/EquipoKit/API/Attachments.swift +36 −0
  • native/apple/Sources/EquipoKit/API/Client.swift +5 −3
  • native/apple/Sources/EquipoKit/API/Thin.swift +1 −0
  • native/apple/Sources/EquipoKit/API/Transport.swift +13 −4
  • native/apple/Sources/EquipoKit/API/UploadProgress.swift +17 −0
  • native/apple/Sources/EquipoKit/Attachments/AttachmentDraft.swift +88 −0
  • native/apple/Sources/EquipoKit/Attachments/AttachmentFile.swift +117 −0
  • native/apple/Sources/EquipoKit/Attachments/AttachmentViews.swift +177 −0
  • native/apple/Sources/EquipoKit/Attachments/AttachmentsFixture.swift +96 −0
  • native/apple/Sources/EquipoKit/Attachments/PhoneAttachmentPicker.swift +76 −0
  • native/apple/Sources/EquipoKit/Resources/Localizable.xcstrings +198 −0
  • native/apple/Sources/EquipoKit/Session/EquipoSession.swift +15 −7
  • native/apple/Sources/EquipoKit/UI/RosterViews.swift +8 −2
  • native/apple/Sources/EquipoKit/UI/Screens/ConversationScreen.swift +15 −7
  • native/apple/Sources/EquipoKit/UI/Screens/PhoneRoot.swift +12 −0
  • native/apple/Sources/EquipoMac/AttachmentPromises.swift +41 −0
  • native/apple/Sources/EquipoMac/EquipoMacApp.swift +2 −1
  • native/apple/Sources/EquipoMac/LiveTranscript.swift +14 −3
  • native/apple/Sources/EquipoMac/MacAttachmentsFixture.swift +61 −0
  • native/apple/Sources/EquipoMac/MacComposer.swift +76 −6
  • native/apple/Tests/EquipoKitTests/AttachmentFollowupTests.swift +114 −0
  • native/apple/Tests/EquipoKitTests/AttachmentHTTPTests.swift +83 −0
  • native/apple/Tests/EquipoKitTests/AttachmentReviewTests.swift +188 −0
  • native/apple/Tests/EquipoKitTests/AttachmentTests.swift +197 −0
  • native/apple/Tests/EquipoKitTests/Fixtures/attachments/large.webp binary
  • native/apple/Tests/EquipoKitTests/MacAttachmentTests.swift +242 −0
  • native/ios/UITests/AttachmentSourceUITests.swift +21 −0
  • native/ios/project.yml +26 −0
  • native/scripts/check-parity.py +1 −1
  • native/scripts/strings.json +19 −1

CI passed — run details

CI log
=== prepare ===
ci-box: machine: aarch64, 32 CPUs, 62 GiB memory, kernel 7.0.0-1017-aws
ci-box: python 3.12.3; Docker version 29.1.3, build 29.1.3-0ubuntu3~24.04.2
ci-box: user namespaces allowed: 233151
ci-box: cgroup: cgroup2fs
ci-box: disk /home/ci/work/repos/oficina__equipo/wt/main: Type  Size Avail | ext4   96G   85G
ci-box: disk /home/ci/.cache/equipo-ci-box: Type  Size Avail | ext4   96G   85G
ci-box: bwrap: fetched and verified in 0.3s
ci-box: claude: fetched and verified in 1.4s
ci-box: codex: fetched and verified in 3.7s
ci-box: codex-code-mode-host: fetched and verified in 1.3s
ci-box: libwrap: fetched and verified in 0.3s
ci-box: socat: fetched and verified in 0.3s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: image pulled in 9.7s
ci-box: pi: installed and verified in 7.3s
ci-box: opencode: installed and verified in 2.2s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 8.8s
ci-box: clone deepened in 4.0s
ci-box: file times set from content: 3028 files, 196 directories
ci-box: ready in 17.6s
=== copy ===
EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
ok  	amadan.net/oficina/equipo/internal/equipotest	0.141s
=== compile ===
go build ./...
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py compile
+ go build -tags testbuild ./...
  1.2s
+ go list -export -test -tags testbuild -f  ./...
  0.6s
+ go list -export -test -tags browser,testbuild -f  ./internal/equipo ./internal/headless ./internal/idtest ./internal/plan3test ./internal/thintest
  0.3s
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -version
staticcheck 2026.1 (v0.7.0)
go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 -version
Go: go1.26.11
Scanner: govulncheck@v1.8.0
DB: https://vuln.go.dev
DB updated: 2026-11-24 15:56:00 +0000 UTC

go run github.com/zricethezav/gitleaks/v8@v8.30.1 version
version is set by build process
=== check ===
--- shard 0 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-work: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadless$/^4c_rebase$|^TestHeadless$/^4b_ask$|^TestHeadless$/^4c_checks_card$|^TestHeadless$/^4_step_crash$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m7.88s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m6.252s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m6.25s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 38.24, cpu waiting 23.26%, memory waiting 0.00%, io waiting 1.03%
--- shard 1 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-review: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadless$/^4_review$|^TestHeadless$/^2b_access$|^TestHeadless$/^runner_crash$|^TestHeadless$/^2b_first_message$|^TestHeadless$/^4_checks_honest$|^TestHeadless$/^7_stream_resume$|^TestHeadless$/^2b_notebook$|^TestHeadless$/^2b_move_in$|^TestHeadless$/^2b_desk_failure$|^TestHeadless$/^cancel$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m6.894s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m5.288s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m5.29s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 38.24, cpu waiting 23.26%, memory waiting 0.00%, io waiting 1.03%
--- shard 2 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-connections: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadlessConnections$|^TestHeadlessTokenPasteEndToEnd$|^TestHeadlessTokenConnection$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m6.275s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m4.367s amadan.net/oficina/equipo/internal/headless
receipt: slow test 56.27s amadan.net/oficina/equipo/internal/headless TestHeadlessConnections
receipt: slow test 4.37s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenPasteEndToEnd
receipt: slow test 3.73s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenConnection
machine: 32 CPUs, load 40.44, cpu waiting 23.75%, memory waiting 0.00%, io waiting 1.06%
--- shard 3 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-mac: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestMacWorker$|^TestHeadlessAttachments$|^TestHeadlessPrewarm$|^TestHeadless$/^1_first_token$|^TestHeadless$/^6_quick_messages$|^TestHeadless$/^8_instance_restart$|^TestHeadless$/^3_runner_offline$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m5s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m3.393s amadan.net/oficina/equipo/internal/headless
receipt: slow test 29.89s amadan.net/oficina/equipo/internal/headless TestMacWorker
receipt: slow test 16.53s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 8.63s amadan.net/oficina/equipo/internal/headless TestHeadlessPrewarm
receipt: slow test 8.34s amadan.net/oficina/equipo/internal/headless TestHeadlessAttachments
machine: 32 CPUs, load 40.44, cpu waiting 23.75%, memory waiting 0.00%, io waiting 1.06%
--- shard 4 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-guards: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadlessCopyRotation$|^TestHeadlessPolicyGuards$|^TestHeadlessRunnerKillLeavesNoCopies$|^TestHeadlessNewHouseRuleStartsFresh$|^TestHeadless$/^3_engineering$|^TestHeadless$/^3_step_cancel$|^TestHeadless$/^3_step_contained$|^TestHeadless$/^3_step_refused$|^TestHeadless$/^3_empty_repo$|^TestHeadless$/^3_empty_engineering$|^TestHeadless$/^3_empty_merge$|^TestHeadless$/^3_empty_merge_rebuilt$|^TestHeadless$/^3_empty_fix_round$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m20.366s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m18.709s amadan.net/oficina/equipo/internal/headless
receipt: slow test 51.18s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 8.92s amadan.net/oficina/equipo/internal/headless TestHeadlessRunnerKillLeavesNoCopies
receipt: slow test 7.4s amadan.net/oficina/equipo/internal/headless TestHeadlessCopyRotation
receipt: slow test 6.74s amadan.net/oficina/equipo/internal/headless TestHeadlessPolicyGuards
receipt: slow test 4.46s amadan.net/oficina/equipo/internal/headless TestHeadlessNewHouseRuleStartsFresh
machine: 32 CPUs, load 36.11, cpu waiting 22.24%, memory waiting 0.00%, io waiting 0.84%
--- shard 5 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-rest: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^TestHeadless$/^4c_rebase$|^TestHeadless$/^4b_ask$|^TestHeadless$/^4c_checks_card$|^TestHeadless$/^4_step_crash$|^TestHeadless$/^4_review$|^TestHeadless$/^2b_access$|^TestHeadless$/^runner_crash$|^TestHeadless$/^2b_first_message$|^TestHeadless$/^4_checks_honest$|^TestHeadless$/^7_stream_resume$|^TestHeadless$/^2b_notebook$|^TestHeadless$/^2b_move_in$|^TestHeadless$/^2b_desk_failure$|^TestHeadless$/^cancel$|^TestHeadlessConnections$|^TestHeadlessTokenPasteEndToEnd$|^TestHeadlessTokenConnection$|^TestMacWorker$|^TestHeadlessAttachments$|^TestHeadlessPrewarm$|^TestHeadless$/^1_first_token$|^TestHeadless$/^6_quick_messages$|^TestHeadless$/^8_instance_restart$|^TestHeadless$/^3_runner_offline$|^TestHeadlessCopyRotation$|^TestHeadlessPolicyGuards$|^TestHeadlessRunnerKillLeavesNoCopies$|^TestHeadlessNewHouseRuleStartsFresh$|^TestHeadless$/^3_engineering$|^TestHeadless$/^3_step_cancel$|^TestHeadless$/^3_step_contained$|^TestHeadless$/^3_step_refused$|^TestHeadless$/^3_empty_repo$|^TestHeadless$/^3_empty_engineering$|^TestHeadless$/^3_empty_merge$|^TestHeadless$/^3_empty_merge_rebuilt$|^TestHeadless$/^3_empty_fix_round$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 2m41.882s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 2m39.858s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m26.59s amadan.net/oficina/equipo/internal/headless TestHeadlessAssistant
receipt: slow test 18.01s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 17.49s amadan.net/oficina/equipo/internal/headless TestHeadlessResearchHandoff
receipt: slow test 6.52s amadan.net/oficina/equipo/internal/headless TestHeadlessTurnBatching
receipt: slow test 6.49s amadan.net/oficina/equipo/internal/headless TestHeadlessBatchAfterRefusedReply
machine: 32 CPUs, load 12.34, cpu waiting 6.03%, memory waiting 0.00%, io waiting 0.21%
--- shard 6 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane thintest: ./internal/thintest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^Test([^C]|C[^o]|Co[^n]|Con[^t])|^TestContract(Assistant|Outcome|Team|Handoff|HostAllowlist|HostIsPerPerson|Look|Use[A-Z]|RemoteCall|LanesRunAtOnce|NoMergeQuestionWhenGateMerges|PreviewHeldUntilPublishAnswer|PreviewNotHeldBelow19|PublishNeedsOwnerAnswer)' ./internal/thintest

receipt: test step 368ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 2m6.369s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 8.17s amadan.net/oficina/equipo/internal/thintest TestContractTeamJobSettledStates
receipt: slow test 6.73s amadan.net/oficina/equipo/internal/thintest TestExplorePreviewsOff
receipt: slow test 3.79s amadan.net/oficina/equipo/internal/thintest TestContractPreviewHeldUntilPublishAnswer
receipt: slow test 3.66s amadan.net/oficina/equipo/internal/thintest TestContractTeamNudgePersonNeeds
receipt: slow test 2.53s amadan.net/oficina/equipo/internal/thintest TestResearchDoneFallsBack
machine: 32 CPUs, load 1.00, cpu waiting 0.45%, memory waiting 0.00%, io waiting 3.11%
--- shard 7 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane thintest-contract: ./internal/thintest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^Test([^C]|C[^o]|Co[^n]|Con[^t])|^TestContract(Assistant|Outcome|Team|Handoff|HostAllowlist|HostIsPerPerson|Look|Use[A-Z]|RemoteCall|LanesRunAtOnce|NoMergeQuestionWhenGateMerges|PreviewHeldUntilPublishAnswer|PreviewNotHeldBelow19|PublishNeedsOwnerAnswer)' ./internal/thintest

receipt: test step 364ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 1m35.659s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 9.1s amadan.net/oficina/equipo/internal/thintest TestContractPreviewNotScheduled
receipt: slow test 5.01s amadan.net/oficina/equipo/internal/thintest TestContractPublishNotOffered
receipt: slow test 4.5s amadan.net/oficina/equipo/internal/thintest TestContractMacRecheckMergeAuthority
receipt: slow test 2.39s amadan.net/oficina/equipo/internal/thintest TestContractRetryFailedPreviewAfterMerge
receipt: slow test 2.39s amadan.net/oficina/equipo/internal/thintest TestContractPublishNameTaken
machine: 32 CPUs, load 1.00, cpu waiting 0.45%, memory waiting 0.00%, io waiting 3.11%
--- shard 8 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-thin: ./internal/runner/thin
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./internal/runner/thin
cache miss: amadan.net/oficina/equipo/internal/runner/thin: its inputs changed
budget note: internal/runner/thin took 4m36.591s, over the 45s its record on line 44 allows; reported only, timing fails on CI

receipt: test step 4m50.317s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 4m36.591s amadan.net/oficina/equipo/internal/runner/thin
receipt: slow test 37s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeAnsweredByAnotherModel
receipt: slow test 36.86s amadan.net/oficina/equipo/internal/runner/thin TestModelsEngineeringProbesThenRunsTheStrongest
receipt: slow test 36.8s amadan.net/oficina/equipo/internal/runner/thin TestModelsUnhealthyRetriedOnDemand
receipt: slow test 18.47s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeRunsInsideTheAdmission
receipt: slow test 6.82s amadan.net/oficina/equipo/internal/runner/thin TestOpenCodeStepsRealOpenCode
machine: 32 CPUs, load 2.47, cpu waiting 0.71%, memory waiting 0.00%, io waiting 0.02%
--- shard 9 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-bug: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestDirectBugWorkflow$|^TestEnrolKeepsTheRole$' ./internal/runner
cache miss: amadan.net/oficina/equipo/internal/runner: its inputs changed

receipt: test step 47.843s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 46.774s amadan.net/oficina/equipo/internal/runner
receipt: slow test 26.74s amadan.net/oficina/equipo/internal/runner TestDirectBugWorkflow
receipt: slow test 20.02s amadan.net/oficina/equipo/internal/runner TestEnrolKeepsTheRole
machine: 32 CPUs, load 39.53, cpu waiting 22.28%, memory waiting 0.00%, io waiting 1.44%
--- shard 10 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-plans: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestPlanWorkflowCandidateOrder$|^TestPlanWorkflowFeature$|^TestCoordinatorRecoveryCallRefusalKeepsServing$|^TestCoordinatorRefusalMatrix$' ./internal/runner
cache miss: amadan.net/oficina/equipo/internal/runner: its inputs changed

receipt: test step 48.133s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 46.249s amadan.net/oficina/equipo/internal/runner
receipt: slow test 36.29s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowCandidateOrder
receipt: slow test 31.73s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowFeature
receipt: slow test 8.39s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryCallRefusalKeepsServing
receipt: slow test 1.56s amadan.net/oficina/equipo/internal/runner TestCoordinatorRefusalMatrix
machine: 32 CPUs, load 39.53, cpu waiting 22.80%, memory waiting 0.00%, io waiting 1.39%
--- shard 11 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-rest: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^TestDirectBugWorkflow$|^TestEnrolKeepsTheRole$|^TestPlanWorkflowCandidateOrder$|^TestPlanWorkflowFeature$|^TestCoordinatorRecoveryCallRefusalKeepsServing$|^TestCoordinatorRefusalMatrix$' ./internal/runner
cache miss: amadan.net/oficina/equipo/internal/runner: its inputs changed

receipt: test step 34.876s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 34.009s amadan.net/oficina/equipo/internal/runner
receipt: slow test 5.12s amadan.net/oficina/equipo/internal/runner TestDirectFaultIsolation
receipt: slow test 3.24s amadan.net/oficina/equipo/internal/runner TestClaimRefusalsBackOff
receipt: slow test 3.11s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryRefusedKeepsServing
receipt: slow test 2.21s amadan.net/oficina/equipo/internal/runner TestToolVerbUnderFakeHarness
receipt: slow test 1.61s amadan.net/oficina/equipo/internal/runner TestReportPostsRetryExactRequest
machine: 32 CPUs, load 29.37, cpu waiting 15.59%, memory waiting 0.00%, io waiting 1.76%
--- shard 12 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-a started 30s late; cpu waiting 30.5%, load 22.61
test lane equipotest-a: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^Test[A-D]|^TestQ' ./internal/equipotest
cache miss: amadan.net/oficina/equipo/internal/equipotest: its inputs changed

receipt: test step 1m6.58s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m4.634s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 28s amadan.net/oficina/equipo/internal/equipotest TestAuthorityCoreIntegration
receipt: slow test 27.97s amadan.net/oficina/equipo/internal/equipotest TestBootstrapNamesOwnersSetting
receipt: slow test 25.92s amadan.net/oficina/equipo/internal/equipotest TestAccountLabelMigration
receipt: slow test 23.36s amadan.net/oficina/equipo/internal/equipotest TestBudgetConfigurationFailuresAreAtomic
receipt: slow test 23.09s amadan.net/oficina/equipo/internal/equipotest TestBudgetConfiguration
machine: 32 CPUs, load 30.26, cpu waiting 17.09%, memory waiting 0.00%, io waiting 0.62%
--- shard 13 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-e started 30s late; cpu waiting 30.5%, load 22.61
test lane equipotest-e: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^Test[E-P]' ./internal/equipotest

receipt: test step 529ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 1m16.793s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 20.72s amadan.net/oficina/equipo/internal/equipotest TestProjectConcurrentRetry
receipt: slow test 20.7s amadan.net/oficina/equipo/internal/equipotest TestProjectsFailuresRollBack
receipt: slow test 20.68s amadan.net/oficina/equipo/internal/equipotest TestProjectWritesRequireCurrentOwner
receipt: slow test 20.67s amadan.net/oficina/equipo/internal/equipotest TestProjectsReopen
receipt: slow test 20.67s amadan.net/oficina/equipo/internal/equipotest TestProjectOwnersAreMembers
machine: 32 CPUs, load 22.61, cpu waiting 12.68%, memory waiting 0.00%, io waiting 1.88%
--- shard 14 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-r started 30s late; cpu waiting 31.1%, load 22.61
test lane equipotest-r: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestR' ./internal/equipotest
cache miss: amadan.net/oficina/equipo/internal/equipotest: its inputs changed

receipt: test step 1m17.482s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m5.119s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 14.73s amadan.net/oficina/equipo/internal/equipotest TestReleaseStampContract
receipt: slow test 13.4s amadan.net/oficina/equipo/internal/equipotest TestRosterChangesAffectExistingSession
receipt: slow test 10.39s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalWhileAssigned
receipt: slow test 10.34s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalRollsBack
receipt: slow test 7.3s amadan.net/oficina/equipo/internal/equipotest TestRosterBootstrapOnce
machine: 32 CPUs, load 26.60, cpu waiting 14.62%, memory waiting 0.00%, io waiting 0.52%
--- shard 15 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-rest started 30s late; cpu waiting 30.5%, load 22.61
test lane equipotest-rest: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^Test[A-D]|^TestQ|^Test[E-P]|^TestR' ./internal/equipotest

receipt: test step 512ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 1m7.287s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 25.88s amadan.net/oficina/equipo/internal/equipotest TestSigninNoProof
receipt: slow test 25.38s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedRollback
receipt: slow test 25.35s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedExistingTeam
receipt: slow test 23.45s amadan.net/oficina/equipo/internal/equipotest TestSigninBackgroundSweep
receipt: slow test 23.39s amadan.net/oficina/equipo/internal/equipotest TestSpecialistSettingsCurrentOwner
machine: 32 CPUs, load 22.61, cpu waiting 12.68%, memory waiting 0.00%, io waiting 1.88%
--- shard 16 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: plan3test started 30s late; cpu waiting 30.5%, load 22.61
test lane plan3test: ./internal/plan3test
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./internal/plan3test

receipt: test step 636ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 52.108s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 3.74s amadan.net/oficina/equipo/internal/plan3test TestPlan3Upgrade
receipt: slow test 3.5s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3B
receipt: slow test 1.69s amadan.net/oficina/equipo/internal/plan3test TestConversationQuestionRace
receipt: slow test 1.52s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3A
receipt: slow test 1.28s amadan.net/oficina/equipo/internal/plan3test TestPlanMigrationUpgrade
machine: 32 CPUs, load 22.61, cpu waiting 12.68%, memory waiting 0.00%, io waiting 1.88%
--- shard 17 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: rest started 30s late; cpu waiting 30.5%, load 22.61
test lane rest: ./cmd/equipo ./cmd/equipo-runner ./cmd/equipo-tool-proxy ./internal/advice ./internal/attach ./internal/attach/attachtest ./internal/chatmarkdown ./internal/chatsend ./internal/chatstream ./internal/coordinator ./internal/coordinatorcontract ./internal/coordinatormail ./internal/copydesk ./internal/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/door ./internal/equipo/housekeeping ./internal/equipo/icons ./internal/equipo/identity ./internal/equipo/kernel ./internal/equipo/library ./internal/equipo/mergegate ./internal/equipo/notifications ./internal/equipo/oficina ./internal/equipo/oficina/oficinatest ./internal/equipo/oficinaid ./internal/equipo/ownermode ./internal/equipo/pause ./internal/equipo/personapi ./internal/equipo/planning ./internal/equipo/push ./internal/equipo/setup ./internal/equipo/team ./internal/equipo/teamcontract ./internal/equipo/triage ./internal/fakeclaude ./internal/fakecodex ./internal/fakeopencode ./internal/fakepi ./internal/idtest ./internal/ownermodetest ./internal/release ./internal/runner/checks ./internal/runner/connect ./internal/runner/containment ./internal/runner/containment/sysunix ./internal/runner/egress ./internal/runner/forge ./internal/runner/forge/forgetest ./internal/runner/heartbeat ./internal/runner/mac ./internal/runner/mcpresource ./internal/runner/metered ./internal/runner/planflow ./internal/runner/provider ./internal/runner/provider/claude ./internal/runner/provider/claude/realcli ./internal/runner/provider/codex ./internal/runner/provider/gotoolchain ./internal/runner/provider/opencode ./internal/runner/provider/pi ./internal/runner/setup ./internal/runner/transporttest ./internal/runner/webread ./internal/runner/workspace ./internal/runnerproto ./internal/schedule ./internal/sealbox ./internal/specialist ./internal/stagingtest ./internal/taskplan ./internal/testci ./internal/toolproxy ./internal/websource ./internal/wire ./internal/wire/forgekey ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./cmd/equipo ./cmd/equipo-runner ./cmd/equipo-tool-proxy ./internal/advice ./internal/attach ./internal/attach/attachtest ./internal/chatmarkdown ./internal/chatsend ./internal/chatstream ./internal/coordinator ./internal/coordinatorcontract ./internal/coordinatormail ./internal/copydesk ./internal/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/door ./internal/equipo/housekeeping ./internal/equipo/icons ./internal/equipo/identity ./internal/equipo/kernel ./internal/equipo/library ./internal/equipo/mergegate ./internal/equipo/notifications ./internal/equipo/oficina ./internal/equipo/oficina/oficinatest ./internal/equipo/oficinaid ./internal/equipo/ownermode ./internal/equipo/pause ./internal/equipo/personapi ./internal/equipo/planning ./internal/equipo/push ./internal/equipo/setup ./internal/equipo/team ./internal/equipo/teamcontract ./internal/equipo/triage ./internal/fakeclaude ./internal/fakecodex ./internal/fakeopencode ./internal/fakepi ./internal/idtest ./internal/ownermodetest ./internal/release ./internal/runner/checks ./internal/runner/connect ./internal/runner/containment ./internal/runner/containment/sysunix ./internal/runner/egress ./internal/runner/forge ./internal/runner/forge/forgetest ./internal/runner/heartbeat ./internal/runner/mac ./internal/runner/mcpresource ./internal/runner/metered ./internal/runner/planflow ./internal/runner/provider ./internal/runner/provider/claude ./internal/runner/provider/claude/realcli ./internal/runner/provider/codex ./internal/runner/provider/gotoolchain ./internal/runner/provider/opencode ./internal/runner/provider/pi ./internal/runner/setup ./internal/runner/transporttest ./internal/runner/webread ./internal/runner/workspace ./internal/runnerproto ./internal/schedule ./internal/sealbox ./internal/specialist ./internal/stagingtest ./internal/taskplan ./internal/testci ./internal/toolproxy ./internal/websource ./internal/wire ./internal/wire/forgekey ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
cache miss: amadan.net/oficina/equipo/internal/runner/provider/claude/realcli: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/copydesk: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/idtest: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/forge: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/equipo/team: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/webread: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/opencode: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/claude: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/workspace: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/codex: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/checks: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/containment: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/pi: its inputs changed
budget note: internal/equipo took 50.61s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/equipo/chat took 15.626s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/equipo/setup took 11.631s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/idtest took 1m40.934s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/release took 23.057s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/runner/containment took 38.847s, over the 15s its record on line 40 allows; reported only, timing fails on CI

receipt: test step 2m14.287s against a 60s target (the gate's other steps are not in this figure)
receipt: 13 packages ran, 53 cached, 17 without tests, 0 failed
receipt: slow package 1m40.934s amadan.net/oficina/equipo/internal/idtest
receipt: slow package 52.455s amadan.net/oficina/equipo/internal/runner/provider/opencode
receipt: slow package 51.765s amadan.net/oficina/equipo/internal/runner/provider/pi
receipt: slow package 50.61s amadan.net/oficina/equipo/internal/equipo
receipt: slow package 38.847s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow test 54.24s amadan.net/oficina/equipo/internal/idtest TestDoorRemembersOficinaID
receipt: slow test 46.05s amadan.net/oficina/equipo/internal/idtest TestDoorOficinaSettingsUnreadableIsNoLoop
receipt: slow test 45.86s amadan.net/oficina/equipo/internal/idtest TestDoorNeverJudgesANativeSession
receipt: slow test 45.61s amadan.net/oficina/equipo/internal/idtest TestDoorForgetsOficinaIDForARefusedSession
receipt: slow test 45.21s amadan.net/oficina/equipo/internal/idtest TestDoorStepUpIsLocal
machine: 32 CPUs, load 12.34, cpu waiting 5.64%, memory waiting 0.00%, io waiting 0.19%
--- shard 18 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-chat: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m18.951s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m17.502s amadan.net/oficina/equipo/internal/headless
receipt: slow test 37.1s amadan.net/oficina/equipo/internal/headless TestBrowserDraftIsTheMessage
receipt: slow test 14.31s amadan.net/oficina/equipo/internal/headless TestBrowserDraftStreamsFormatted
receipt: slow test 9.16s amadan.net/oficina/equipo/internal/headless TestBrowserChat
receipt: slow test 7.11s amadan.net/oficina/equipo/internal/headless TestBrowserComposer
receipt: slow test 4.99s amadan.net/oficina/equipo/internal/headless TestBrowserChatSendStaysOnPage
machine: 32 CPUs, load 36.11, cpu waiting 22.24%, memory waiting 0.00%, io waiting 0.84%
--- shard 19 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-work: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m17.835s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m16.155s amadan.net/oficina/equipo/internal/headless
receipt: slow test 23.12s amadan.net/oficina/equipo/internal/headless TestBrowserRailFollowsWork
receipt: slow test 17.8s amadan.net/oficina/equipo/internal/headless TestBrowserTaskThread
receipt: slow test 12.06s amadan.net/oficina/equipo/internal/headless TestBrowserReceiptFollowsReview
receipt: slow test 8.15s amadan.net/oficina/equipo/internal/headless TestBrowserAskAfterMerge
receipt: slow test 6.83s amadan.net/oficina/equipo/internal/headless TestBrowserTaskCard
machine: 32 CPUs, load 36.11, cpu waiting 22.24%, memory waiting 0.00%, io waiting 0.84%
--- shard 20 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-connections: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m45.263s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m43.71s amadan.net/oficina/equipo/internal/headless
receipt: slow test 13.12s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAddPage
receipt: slow test 11.32s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAdd
receipt: slow test 11.11s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsSignInEmail
receipt: slow test 10.64s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsConversation
receipt: slow test 10.61s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsMeteredLimitRequired
machine: 32 CPUs, load 28.39, cpu waiting 15.08%, memory waiting 0.00%, io waiting 0.54%
--- shard 21 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-rest: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAskAfterMerge|TestBrowserChat|TestBrowserChatSendStaysOnPage|TestBrowserComposer|TestBrowserComposerDock|TestBrowserComposerFocus|TestBrowserComposerReconcile|TestBrowserConnectionsAdd|TestBrowserConnectionsAddPage|TestBrowserConnectionsConversation|TestBrowserConnectionsCopyLink|TestBrowserConnectionsEndedNote|TestBrowserConnectionsMeteredLimitRequired|TestBrowserConnectionsOpenCodeGoLimitRequired|TestBrowserConnectionsSignIn|TestBrowserConnectionsSignInEmail|TestBrowserConnectionsSignInSwitch|TestBrowserConnectionsToken|TestBrowserCopyContinue|TestBrowserCopySettingAndFlag|TestBrowserDraftIsTheMessage|TestBrowserDraftStreamsFormatted|TestBrowserEmptyExplore|TestBrowserMoveIn|TestBrowserNotebook|TestBrowserNotebookLook|TestBrowserPasteBox|TestBrowserPasteBoxLook|TestBrowserPasteCopiesItsBox|TestBrowserRailFollowsWork|TestBrowserReceiptFollowsReview|TestBrowserReceiptsDesktop|TestBrowserReceiptsTouch|TestBrowserRefreshRace|TestBrowserStalePageReloads|TestBrowserTaskCard|TestBrowserTaskThread|TestBrowserThinkingAndCards|TestBrowserUsageAndAdvice|TestBrowserWaitingTurns|TestNotebookScreenshots)$' -skip '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$|^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$|^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed
rastrillo: budget test: go test failed
--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserCopyContinue
=== RUN   TestBrowserCopyContinue
time=2026-11-26T00:35:29.113Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-26T00:35:29.113Z level=INFO msg="startup phase done" phase=state_lock took=233µs
time=2026-11-26T00:35:29.113Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-26T00:35:29.113Z level=INFO msg="startup phase done" phase=claim_roots took=210µs
time=2026-11-26T00:35:29.113Z level=INFO msg="startup phase" phase=sweep
time=2026-11-26T00:35:29.161Z level=INFO msg="startup phase done" phase=sweep took=47.557ms
time=2026-11-26T00:35:29.163Z level=INFO msg="startup phase" phase=credentials
time=2026-11-26T00:35:29.163Z level=INFO msg="startup phase done" phase=credentials took=280µs
time=2026-11-26T00:35:29.163Z level=INFO msg="startup phase" phase=open_state
time=2026-11-26T00:35:29.207Z level=INFO msg="startup phase done" phase=open_state took=44.336ms
time=2026-11-26T00:35:29.208Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-26T00:35:29.210Z level=INFO msg=connecting host=127.0.0.1:42239 protocol=30
time=2026-11-26T00:35:29.212Z level=INFO msg=connected host=127.0.0.1:42239 took=877µs
time=2026-11-26T00:35:29.212Z level=INFO msg="capabilities gathering"
time=2026-11-26T00:35:29.212Z level=INFO msg="capabilities gathered" took=458µs tags=linux,claude,go
time=2026-11-26T00:35:29.213Z level=INFO msg="hello sent" protocol=30
time=2026-11-26T00:35:29.218Z level=INFO msg=welcome protocol=30 role=primary generation=1
    browser_copy_test.go:93: continue did not reach Checks: 0 <nil>
--- FAIL: TestBrowserCopyContinue (2.00s)

--- FAIL amadan.net/oficina/equipo/internal/headless (package output)
FAIL
rastrillo-budget/v1 ran 1m19.9s
FAIL	amadan.net/oficina/equipo/internal/headless	80.088s


receipt: test step 1m21.397s against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 0 cached, 0 without tests, 1 failed
receipt: slow package 1m19.9s amadan.net/oficina/equipo/internal/headless
receipt: slow test 14.5s amadan.net/oficina/equipo/internal/headless TestBrowserThinkingAndCards
receipt: slow test 10.24s amadan.net/oficina/equipo/internal/headless TestBrowserStalePageReloads
receipt: slow test 9.09s amadan.net/oficina/equipo/internal/headless TestBrowserWaitingTurns
receipt: slow test 8.96s amadan.net/oficina/equipo/internal/headless TestBrowserMoveIn
receipt: slow test 7.21s amadan.net/oficina/equipo/internal/headless TestBrowserRefreshRace
exit status 1
+ go test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAskAfterMerge|TestBrowserChat|TestBrowserChatSendStaysOnPage|TestBrowserComposer|TestBrowserComposerDock|TestBrowserComposerFocus|TestBrowserComposerReconcile|TestBrowserConnectionsAdd|TestBrowserConnectionsAddPage|TestBrowserConnectionsConversation|TestBrowserConnectionsCopyLink|TestBrowserConnectionsEndedNote|TestBrowserConnectionsMeteredLimitRequired|TestBrowserConnectionsOpenCodeGoLimitRequired|TestBrowserConnectionsSignIn|TestBrowserConnectionsSignInEmail|TestBrowserConnectionsSignInSwitch|TestBrowserConnectionsToken|TestBrowserCopyContinue|TestBrowserCopySettingAndFlag|TestBrowserDraftIsTheMessage|TestBrowserDraftStreamsFormatted|TestBrowserEmptyExplore|TestBrowserMoveIn|TestBrowserNotebook|TestBrowserNotebookLook|TestBrowserPasteBox|TestBrowserPasteBoxLook|TestBrowserPasteCopiesItsBox|TestBrowserRailFollowsWork|TestBrowserReceiptFollowsReview|TestBrowserReceiptsDesktop|TestBrowserReceiptsTouch|TestBrowserRefreshRace|TestBrowserStalePageReloads|TestBrowserTaskCard|TestBrowserTaskThread|TestBrowserThinkingAndCards|TestBrowserUsageAndAdvice|TestBrowserWaitingTurns|TestNotebookScreenshots)$' -skip '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$|^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$|^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' -v -run '^TestBrowserCopyContinue$' -count=1 ./internal/headless   (retry, once)
##############################################################################
FLAKE ./internal/headless:TestBrowserCopyContinue browser-headless-rest eb36731524663399e39a543080413d0dda0716ae 2.00s 34.58
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
machine: 32 CPUs, load 34.58, cpu waiting 20.54%, memory waiting 0.00%, io waiting 0.76%
--- shard 22 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-rest: ./internal/equipo
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserPreviewBlocksNavigation)$' ./internal/equipo

receipt: test step 295ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 690ms amadan.net/oficina/equipo/internal/equipo
receipt: slow test 690ms amadan.net/oficina/equipo/internal/equipo TestBrowserPreviewBlocksNavigation
browser lane browser-rest: ./internal/idtest
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserOficinaIDDoor|TestBrowserSmartDoor)$' ./internal/idtest
budget note: internal/idtest took 10.907s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI

receipt: test step 325ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 10.907s amadan.net/oficina/equipo/internal/idtest
receipt: slow test 8.83s amadan.net/oficina/equipo/internal/idtest TestBrowserSmartDoor
receipt: slow test 2.08s amadan.net/oficina/equipo/internal/idtest TestBrowserOficinaIDDoor
browser lane browser-rest: ./internal/plan3test
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestTeamsHierarchyBrowser)$' ./internal/plan3test

receipt: test step 311ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 2.19s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 2.19s amadan.net/oficina/equipo/internal/plan3test TestTeamsHierarchyBrowser
browser lane browser-rest: ./internal/thintest
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAccessEmojiByline|TestBrowserAccessFinalOutcomes|TestBrowserAccessRequest|TestBrowserAccessReview|TestBrowserActivitySubjects|TestBrowserAutonomySettings|TestBrowserCoordinatorQueue|TestBrowserEmptyConversation|TestBrowserEndedNoteStaysGone|TestBrowserHousekeeping|TestBrowserInnerGallery|TestBrowserInnerScreens|TestBrowserInstantThinking|TestBrowserInstantThinkingQueued|TestBrowserMachines|TestBrowserPausedWork|TestBrowserPhoneIndex|TestBrowserPlacementQuestionAndPending|TestBrowserProjectPlacement|TestBrowserProjectsList|TestBrowserReportActionFeedback|TestBrowserReportNextSteps|TestBrowserReportThread|TestBrowserRhythm|TestBrowserRollup|TestBrowserRosterAlignment|TestBrowserRosterDecisionStates|TestBrowserRosterQuietDay|TestBrowserRosterReports|TestBrowserRosterSetAside|TestBrowserRosterSubchat|TestBrowserRosterThinking|TestBrowserRosterVisual|TestBrowserSettingsHousekeepingGroups|TestBrowserSettingsMenu|TestBrowserSettingsRail|TestBrowserSettingsSaveBar|TestBrowserSettingsShots|TestBrowserSettingsStayOnPage|TestBrowserSettingsTeams|TestBrowserShipsButtons|TestBrowserSpecialistRows|TestBrowserSpendFollowsAnswers|TestBrowserTaskRows|TestBrowserTeamPanel|TestBrowserThinkingCycles|TestBrowserThinkingLinesClear|TestBrowserThinkingSteady|TestBrowserThinkingWords|TestBrowserTokenRowEmail|TestBrowserTrackPulse|TestBrowserTrackStarCentre|TestBrowserTryAgain)$' ./internal/thintest

receipt: test step 317ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 3m35.78s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 23.07s amadan.net/oficina/equipo/internal/thintest TestBrowserAccessRequest
receipt: slow test 14.43s amadan.net/oficina/equipo/internal/thintest TestBrowserSettingsTeams
receipt: slow test 12.04s amadan.net/oficina/equipo/internal/thintest TestBrowserThinkingCycles
receipt: slow test 10.74s amadan.net/oficina/equipo/internal/thintest TestBrowserPlacementQuestionAndPending
receipt: slow test 9.29s amadan.net/oficina/equipo/internal/thintest TestBrowserRhythm
machine: 32 CPUs, load 4.05, cpu waiting 1.55%, memory waiting 0.00%, io waiting 3.01%
--- shard 23 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
shard 23: make test-quarantine
python3 scripts/ci-test.py quarantine
quarantine: 12 tests from scripts/ci-quarantine.txt; a failure is retried once, and a pass on the retry is reported as a flake
+ go test -tags testbuild -timeout 15m -v -run '^TestHeadlessConnections$/^A5_cancel_and_sign_out$|^TestHeadlessConnections$/^C4_claude_sign_in$|^TestHeadlessConnections$/^C5_engineering_failover$|^TestHeadlessConnections$/^C5_engineering_to_codex$|^TestHeadlessConnections$/^C5_engineering_waits$' ./internal/headless   (46s)
ok ./internal/headless TestHeadlessConnections/A5_cancel_and_sign_out 4.48s
ok ./internal/headless TestHeadlessConnections/C4_claude_sign_in 1.23s
ok ./internal/headless TestHeadlessConnections/C5_engineering_failover 6.55s
ok ./internal/headless TestHeadlessConnections/C5_engineering_to_codex 7.36s
ok ./internal/headless TestHeadlessConnections/C5_engineering_waits 24.51s
+ go test -tags testbuild -timeout 15m -v -run '^TestHeadlessConnections$/^C5_review_auth$|^TestHeadlessConnections$/^C5_review_failover$|^TestHeadlessConnections$/^C5_review_on_codex$|^TestHeadlessConnections$/^C5_review_other_family_first$' ./internal/headless   (52s)
ok ./internal/headless TestHeadlessConnections/C5_review_auth 11.11s
ok ./internal/headless TestHeadlessConnections/C5_review_failover 9.50s
ok ./internal/headless TestHeadlessConnections/C5_review_on_codex 18.23s
ok ./internal/headless TestHeadlessConnections/C5_review_other_family_first 11.57s
+ go test -tags testbuild -timeout 15m -v -run '^TestMixedVersions$' ./internal/headless   (18s)
ok ./internal/headless TestMixedVersions 16.10s
+ go test -tags testbuild -timeout 15m -v -run '^TestCheckSandboxDeniedPathsTampering$' ./internal/runner/checks   (1s)
ok ./internal/runner/checks TestCheckSandboxDeniedPathsTampering 0.82s
+ go test -tags testbuild -timeout 15m -v -run '^TestRunnerCancelAndSupersede$' ./internal/runner/thin   (0s)
ok ./internal/runner/thin TestRunnerCancelAndSupersede 0.05s
quarantine: 0 flaked (passed on the retry), 0 failed
machine: 32 CPUs, load 41.01, cpu waiting 23.42%, memory waiting 0.00%, io waiting 1.30%
--- shard 24 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
shard 24: make runner-host
python3 scripts/runner-prerequisites.py
CGO_ENABLED=0 RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py retried runner-host -run 'TestDirect|TestProvider|TestCheckSandbox' -count=1 ./internal/runner/provider/... ./internal/runner/checks
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -run 'TestDirect|TestProvider|TestCheckSandbox' -count=1 ./internal/runner/provider/... ./internal/runner/checks

receipt: test step 8.463s against a 60s target (the gate's other steps are not in this figure)
receipt: 4 packages ran, 0 cached, 4 without tests, 0 failed
receipt: slow package 7.346s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow package 163ms amadan.net/oficina/equipo/internal/runner/provider/claude
receipt: slow package 98ms amadan.net/oficina/equipo/internal/runner/provider/codex
receipt: slow package 4ms amadan.net/oficina/equipo/internal/runner/provider/opencode
receipt: slow package 1ms amadan.net/oficina/equipo/internal/runner/provider
receipt: slow test 5.19s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsGoFixture
receipt: slow test 1.67s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPaths
receipt: slow test 350ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsCache
receipt: slow test 160ms amadan.net/oficina/equipo/internal/runner/provider/claude TestDirectJournalAdapterBarrier
receipt: slow test 120ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxToolchain
CGO_ENABLED=0 RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py retried runner-host -run '^TestNamespace' -count=1 ./internal/runner/containment
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -run '^TestNamespace' -count=1 ./internal/runner/containment

receipt: test step 3.145s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 2.808s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow test 270ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReadOnlyScratch
receipt: slow test 190ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryUnavailableProof
receipt: slow test 110ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceDirectPolicyAdmission
receipt: slow test 100ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReapsOrphans
receipt: slow test 100ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryCleansScratch
machine: 32 CPUs, load 9.50, cpu waiting 5.42%, memory waiting 0.00%, io waiting 2.54%
--- shard 25 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: runner-dead-references started 30s late; cpu waiting 31.1%, load 22.61
shard 25: make runner-dead-references lanes-check build vet fmt-check spacing budget migration-check
python3 scripts/runner-dead-references.py
reference scan: 2740 text files, 3228 matches, 0 failures
python3 scripts/ci-test.py check
lanes: 18 lanes and 5 browser lanes run every test once; 20-check@29
CGO_ENABLED=0 go build ./...
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o /dev/null ./cmd/equipo-runner
go vet ./...
go vet -tags testbuild ./internal/runner/thin ./internal/headless
GOOS=darwin GOARCH=arm64 go vet ./cmd/equipo-runner/... ./internal/runner/... ./internal/wire/... ./internal/release/...
go tool fiesta spacing -skip tokens.css internal/equipo/static
go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget size
budget size: 92 directories within budget
CGO_ENABLED=0 go test ./internal/equipo -run '^TestMigrationModels$' -count=1
ok  	amadan.net/oficina/equipo/internal/equipo	2.523s
machine: 32 CPUs, load 38.01, cpu waiting 21.35%, memory waiting 0.00%, io waiting 1.49%
--- shard 26 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: staticcheck started 30s late; cpu waiting 31.1%, load 22.61
shard 26: make staticcheck
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -tags browser,perf,testbuild ./...
machine: 32 CPUs, load 29.37, cpu waiting 14.36%, memory waiting 0.00%, io waiting 1.82%
--- shard 27 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: govulncheck started 30s late; cpu waiting 30.5%, load 22.61
shard 27: make govulncheck
go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 ./...
=== Symbol Results ===

No vulnerabilities found.

Your code is affected by 0 vulnerabilities.
This scan also found 0 vulnerabilities in packages you import and 3
vulnerabilities in modules you require, but your code doesn't appear to call
these vulnerabilities.
Use '-show verbose' for more details.
machine: 32 CPUs, load 29.37, cpu waiting 16.95%, memory waiting 0.00%, io waiting 1.70%
--- shard 28 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: gitleaks started 30s late; cpu waiting 30.5%, load 22.61
shard 28: make gitleaks
12:35AM INF Unknown SCM platform. Use --platform to include links in findings. host=amadan.net
12:35AM INF 1161 commits scanned.
12:35AM INF scanned ~66155079 bytes (66.16 MB) in 14.1s
12:35AM INF no leaks found
machine: 32 CPUs, load 38.01, cpu waiting 20.41%, memory waiting 0.00%, io waiting 1.54%
=== perf ===
go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -require TestPerfScreens,TestPerfBoot -tags perf -count=1 -p 1 -parallel 1 -run '^TestPerf' ./...
perf: GET /: median 1.044ms, worst 1.077ms, budget 150ms
perf: GET /api/runner/protocol: median 86µs, worst 102µs, budget 150ms
perf: GET /api/v1/account-setups/{id}: median 590µs, worst 634µs, budget 150ms
perf: GET /api/v1/accounts: median 402µs, worst 438µs, budget 150ms
perf: GET /api/v1/auth/devices: median 428µs, worst 452µs, budget 150ms
perf: GET /api/v1/budgets: median 468µs, worst 491µs, budget 150ms
perf: GET /api/v1/capabilities: median 243µs, worst 262µs, budget 150ms
perf: GET /api/v1/cards/{id}: median 1.154ms, worst 1.187ms, budget 150ms
perf: GET /api/v1/connections: median 534µs, worst 566µs, budget 150ms
perf: GET /api/v1/connections/{id}: median 504µs, worst 536µs, budget 150ms
perf: GET /api/v1/conversation: median 867µs, worst 926µs, budget 150ms
perf: GET /api/v1/conversation/cards: median 1.415ms, worst 1.512ms, budget 150ms
perf: GET /api/v1/coordinator: median 1.694ms, worst 1.821ms, budget 150ms
perf: GET /api/v1/invites/{id}: median 464µs, worst 476µs, budget 150ms
perf: GET /api/v1/journey: median 7.341ms, worst 7.562ms, budget 150ms
perf: GET /api/v1/me: median 426µs, worst 471µs, budget 150ms
perf: GET /api/v1/me/settings: median 517µs, worst 542µs, budget 150ms
perf: GET /api/v1/needs-you: median 7.272ms, worst 7.351ms, budget 150ms
perf: GET /api/v1/notifications: median 1.615ms, worst 1.715ms, budget 150ms
perf: GET /api/v1/onboarding: median 404µs, worst 422µs, budget 150ms
perf: GET /api/v1/people: median 427µs, worst 477µs, budget 150ms
perf: GET /api/v1/playbooks: median 564µs, worst 605µs, budget 150ms
perf: GET /api/v1/playbooks/{id}: median 529µs, worst 589µs, budget 150ms
perf: GET /api/v1/playbooks/{id}/template-diff: median 880µs, worst 915µs, budget 150ms
perf: GET /api/v1/preferences: median 778µs, worst 836µs, budget 150ms
perf: GET /api/v1/projects/{id}: median 482µs, worst 507µs, budget 150ms
perf: GET /api/v1/projects/{id}/settings: median 604µs, worst 662µs, budget 150ms
perf: GET /api/v1/roster: median 475µs, worst 500µs, budget 150ms
perf: GET /api/v1/runners/{id}: median 433µs, worst 456µs, budget 150ms
perf: GET /api/v1/specialists: median 8.15ms, worst 10.273ms, budget 150ms
perf: GET /api/v1/specialists/{id}: median 7.825ms, worst 7.947ms, budget 150ms
perf: GET /api/v1/specialists/{id}/template-diff: median 841µs, worst 897µs, budget 150ms
perf: GET /api/v1/tasks/{id}/plan: median 1.123ms, worst 1.194ms, budget 150ms
perf: GET /api/v1/tasks/{id}/thread: median 705µs, worst 734µs, budget 150ms
perf: GET /api/v1/teams: median 436µs, worst 455µs, budget 150ms
perf: GET /api/v1/templates: median 600µs, worst 611µs, budget 150ms
perf: GET /api/v1/templates/{id}: median 451µs, worst 463µs, budget 150ms
perf: GET /auth/callback: median 76µs, worst 113µs, budget 150ms
perf: GET /auth/devices/{id}: median 3.734ms, worst 3.802ms, budget 150ms
perf: GET /auth/verify: median 74µs, worst 97µs, budget 150ms
perf: GET /connections: median 4.039ms, worst 4.093ms, budget 150ms
perf: GET /conversation: median 8.033ms, worst 8.151ms, budget 150ms
perf: GET /conversation/connections: median 246µs, worst 276µs, budget 150ms
perf: GET /conversation/notebook: median 241µs, worst 286µs, budget 150ms
perf: GET /conversation/settings: median 4.347ms, worst 4.407ms, budget 150ms
perf: GET /conversation/settings/autonomy: median 4.301ms, worst 4.463ms, budget 150ms
perf: GET /conversation/settings/connections: median 6.731ms, worst 7.063ms, budget 150ms
perf: GET /conversation/settings/connections/add: median 6.998ms, worst 7.522ms, budget 150ms
perf: GET /conversation/settings/copy: median 4.382ms, worst 4.43ms, budget 150ms
perf: GET /conversation/settings/housekeeping: median 4.376ms, worst 4.51ms, budget 150ms
perf: GET /conversation/settings/machines: median 4.714ms, worst 4.751ms, budget 150ms
perf: GET /conversation/settings/machines/add: median 4.727ms, worst 4.777ms, budget 150ms
perf: GET /conversation/settings/notebook: median 3.699ms, worst 3.76ms, budget 150ms
perf: GET /conversation/settings/thinking: median 4.231ms, worst 4.331ms, budget 150ms
perf: GET /housekeeping: median 4.091ms, worst 4.163ms, budget 150ms
perf: GET /invites/new: median 599µs, worst 618µs, budget 150ms
perf: GET /invites/{id}: median 623µs, worst 678µs, budget 150ms
perf: GET /jobs: median 3.829ms, worst 4.022ms, budget 150ms
perf: GET /jobs/{id}: median 5.067ms, worst 5.363ms, budget 150ms
perf: GET /journey: median 10.62ms, worst 10.687ms, budget 150ms
perf: GET /nav/rail: median 3.269ms, worst 3.414ms, budget 150ms
perf: GET /needs-you: median 10.182ms, worst 10.416ms, budget 150ms
perf: GET /onboarding: median 4.289ms, worst 4.371ms, budget 150ms
perf: GET /people: median 3.681ms, worst 3.759ms, budget 150ms
perf: GET /playbook-suggestions/{suggestion}: median 5.626ms, worst 5.703ms, budget 150ms
perf: GET /playbooks: median 5.251ms, worst 5.354ms, budget 150ms
perf: GET /playbooks/new: median 5.486ms, worst 8.387ms, budget 150ms
perf: GET /playbooks/{id}: median 5.005ms, worst 5.197ms, budget 150ms
perf: GET /playbooks/{id}/edit: median 4.932ms, worst 5.031ms, budget 150ms
perf: GET /playbooks/{id}/template-diff: median 4.158ms, worst 4.33ms, budget 150ms
perf: GET /preferences: median 4.537ms, worst 4.616ms, budget 150ms
perf: GET /preferences/sources/{source}: median 4.351ms, worst 4.478ms, budget 150ms
perf: GET /projects: median 6.053ms, worst 6.161ms, budget 150ms
perf: GET /projects/accounts: median 3.953ms, worst 4.048ms, budget 150ms
perf: GET /projects/new: median 3.916ms, worst 4.048ms, budget 150ms
perf: GET /projects/{id}: median 10.755ms, worst 11.045ms, budget 150ms
perf: GET /projects/{id}/edit: median 4.29ms, worst 6.193ms, budget 150ms
perf: GET /runners/enrol: median 5.048ms, worst 5.223ms, budget 150ms
perf: GET /settings: median 4.006ms, worst 4.225ms, budget 150ms
perf: GET /settings/coordinator: median 5.921ms, worst 6.02ms, budget 150ms
perf: GET /settings/devices: median 3.661ms, worst 3.796ms, budget 150ms
perf: GET /settings/recovery: median 3.838ms, worst 3.957ms, budget 150ms
perf: GET /settings/recovery/release: median 3.819ms, worst 3.871ms, budget 150ms
perf: GET /settings/thinking: median 248µs, worst 295µs, budget 150ms
perf: GET /signed-out: median 266µs, worst 291µs, budget 150ms
perf: GET /signin: median 270µs, worst 319µs, budget 150ms
perf: GET /specialists/new: median 3.739ms, worst 3.922ms, budget 150ms
perf: GET /specialists/{key}: median 10.899ms, worst 11.015ms, budget 150ms
perf: GET /specialists/{key}/edit: median 3.985ms, worst 4.044ms, budget 150ms
perf: GET /specialists/{key}/template-diff: median 4.062ms, worst 4.093ms, budget 150ms
perf: GET /tasks: median 6.112ms, worst 6.352ms, budget 150ms
perf: GET /tasks/new: median 3.629ms, worst 3.809ms, budget 150ms
perf: GET /tasks/{id}: median 5.849ms, worst 6.086ms, budget 150ms
perf: GET /tasks/{id}/merge: median 5.203ms, worst 5.362ms, budget 150ms
perf: GET /tasks/{id}/move: median 5.067ms, worst 5.292ms, budget 150ms
perf: GET /tasks/{id}/plan: median 6.068ms, worst 6.168ms, budget 150ms
perf: GET /tasks/{id}/preview: median 1.506ms, worst 1.655ms, budget 150ms
perf: GET /tasks/{id}/questions/{question}: median 5.485ms, worst 5.587ms, budget 150ms
perf: GET /tasks/{id}/rendered-change: median 5.009ms, worst 5.126ms, budget 150ms
perf: GET /tasks/{id}/rendered-change/{hash}.png: median 4.491ms, worst 4.589ms, budget 150ms
perf: GET /tasks/{id}/thread: median 8.651ms, worst 10.814ms, budget 150ms
perf: GET /team/{specialist}: median 4.783ms, worst 4.915ms, budget 150ms
perf: GET /teams: median 10.476ms, worst 10.601ms, budget 150ms
perf: GET /templates: median 3.783ms, worst 3.876ms, budget 150ms
perf: GET /usage: median 4.66ms, worst 4.759ms, budget 150ms
perf: GET /work: median 3.37ms, worst 3.479ms, budget 150ms
perf: GET /auth/devices/{id}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /connections: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation/settings: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation/settings/autonomy: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation/settings/connections: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation/settings/connections/add: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation/settings/copy: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation/settings/housekeeping: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation/settings/machines: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation/settings/machines/add: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation/settings/notebook: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation/settings/thinking: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /housekeeping: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /invites/new: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /invites/{id}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /jobs: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /jobs/{id}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /journey: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /nav/rail: 0 bytes of framework CSS and JS, gzipped; 16000-byte budget
perf: GET /needs-you: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /onboarding: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /people: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /playbook-suggestions/{suggestion}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /playbooks: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /playbooks/new: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /playbooks/{id}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /playbooks/{id}/edit: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /playbooks/{id}/template-diff: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /preferences: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /preferences/sources/{source}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /projects: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /projects/accounts: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /projects/new: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /projects/{id}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /projects/{id}/edit: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /runners/enrol: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /settings: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /settings/coordinator: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /settings/devices: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /settings/recovery: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /settings/recovery/release: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /signed-out: 30270 bytes of framework CSS and JS, gzipped; 40000-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /specialists/new: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /specialists/{key}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /specialists/{key}/edit: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /specialists/{key}/template-diff: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /tasks: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /tasks/new: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /tasks/{id}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /tasks/{id}/merge: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /tasks/{id}/move: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /tasks/{id}/plan: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /tasks/{id}/preview: 25954 bytes of framework CSS and JS, gzipped; 40000-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /tasks/{id}/questions/{question}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /tasks/{id}/rendered-change: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /tasks/{id}/thread: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /team/{specialist}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /teams: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /templates: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /usage: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /work: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: cold boot: median 157ms of [151.61954ms 157.415214ms 158.686942ms], budget 500ms

receipt: test step 32.589s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 88 without tests, 0 failed
receipt: slow package 10.318s amadan.net/oficina/equipo/internal/equipotest
receipt: slow package 1ms amadan.net/oficina/equipo/internal/wire/wireschema
receipt: slow package 0s amadan.net/oficina/equipo/cmd/equipo
receipt: slow package 0s amadan.net/oficina/equipo/cmd/equipo-runner
receipt: slow package 0s amadan.net/oficina/equipo/cmd/equipo-tool-proxy
receipt: slow test 9.8s amadan.net/oficina/equipo/internal/equipotest TestPerfScreens
receipt: slow test 510ms amadan.net/oficina/equipo/internal/equipotest TestPerfBoot
=== cache ===
ci-box: build cache /home/ci/work/repos/oficina__equipo/cache/go-build: 3.97 GiB in 25404 files
ci-box: module cache /home/ci/work/repos/oficina__equipo/cache/go-mod: 1.15 GiB in 40997 files
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-native-attachments.md b/docs/superpowers/plans/CONTROLLER-REPORT-native-attachments.md
new file mode 100644
index 00000000..a3fdd108
--- /dev/null
+++ b/docs/superpowers/plans/CONTROLLER-REPORT-native-attachments.md
@@ -0,0 +1,335 @@
+# Native composer attachments
+
+Branch: `native/attachments`, in its own physical-TMPDIR worktree, based on
+`origin/main` at `2950f604`, then rebased before its first push onto landed main
+`4024216e` (including the stopped-work release follow-up). String catalogs
+were regenerated from the union of both slices' reviewed keys; both debug
+fixture entry points and the landed stopped-work behavior were retained.
+
+## Behavior
+
+The conversation composer accepts up to five attachments. On iPhone, the
+plus menu offers Photos (PhotosPicker), Camera, Files, and Paste. PhotosPicker
+does not request full-library access. HEIC/HEIF photos convert to JPEG with
+orientation applied and source metadata omitted. Mac clipboard TIFF images
+also convert to JPEG. Mac supports image/file paste and drag-and-drop through
+the AppKit composer. Area capture is omitted as agreed with the controller:
+a permission-free area capture path was not established; ScreenCaptureKit
+capture requires Screen Recording permission.
+
+The source file is checked before upload: at most 10 MiB, 12,000 pixels per
+side, and 40 megapixels. These constants are POST /attachments' published v1
+contract and `internal/attach/attach.go`; /capabilities does not publish
+configurable attachment limits. Converted JPEG bytes are checked again.
+Files are read with a maximum byte count; image dimensions are read before
+raster conversion.
+
+Each item has upload progress, failure, retry, and remove. Failed and uploading
+items block sending. Removing an item prevents a late response from restoring
+it. Sending carries the uploaded ids in /messages, including attachment-only
+messages. The session keeps attachment metadata with a pending outgoing
+message; retry keeps its ids and idempotency key. Signing out clears the draft.
+
+Sent bubbles fetch thumbnails through authenticated /attachments/{id}/preview
+reads. Tapping opens the original through /attachments/{id}, full screen on
+iPhone and in a sheet on Mac. Images, text files, and PDFs have native previews.
+The transport remains ephemeral, without cookie storage or redirects, including
+the upload delegate. No server route changed.
+
+Share extension, recent-screenshot offers, area capture, and task-thread
+attachments are outside this slice.
+
+## Copy
+
+The web's chat.attach.* and api.attachment_* entries are copied into the
+catalog byte-identically, except the existing %s to %@ native format conversion.
+team.close is the existing reviewed web word. Parity covers these namespaces.
+
+The five native-only entries were approved by Luna through the controller on
+2026-11-25:
+
+| Key | Value | Use |
+| --- | --- | --- |
+| native.attach.photos | Photos | Picker menu |
+| native.attach.camera | Camera | Picker menu |
+| native.attach.files | Files | Picker menu |
+| native.attach.paste | Paste | Picker menu |
+| native.attach.camera_usage | Use your camera to take a photo to attach to your message. | Camera purpose string |
+
+Approval is recorded beside the menu labels and Info.plist source in
+project.yml. Fixture message text is illustrative user content, not runtime
+interface copy. No further copy questions.
+
+## Test-first evidence
+
+`swift test --package-path native/apple --filter AttachmentTests` first
+failed because AttachmentLimits, AttachmentFile, AttachmentDraft and attachment
+API methods were absent. The initial tests covered byte/pixel/type limits,
+HEIC conversion, upload headers, message attachment ids, image delivery to a
+fake Coordinator, failed upload retry, removal, and the send gate.
+
+The expanded `swift test --package-path native/apple --filter Attachment`
+passed 10 tests in three suites. It also covers reservation of all five slots
+while uploading, an invalid image never reaching the upload endpoint, late
+completion after removal, duplicate ids, clearing the draft after send and
+sign-out, and the Mac paste/drop entry point.
+
+A real loopback HTTP server test exercises URLSession's raw upload and progress
+delegate. The server resolves the submitted message ids to uploaded image
+bytes before exposing the fake Coordinator's received image; the test compares
+those bytes with the source image. The server binds only 127.0.0.1 and is
+terminated after the test.
+
+The actual Coordinator already converts attachments to Claude image content
+and Codex localImage input, covered by
+`internal/headless/attachments_test.go:TestHeadlessAttachments`. The local
+command `GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0 go test ./internal/headless -run
+TestHeadlessAttachments -count=1` could not build on macOS because
+`internal/toolproxy/stdio.go` uses Linux `unix.O_PATH`. Linux hub CI remains
+the gate for those server tests.
+
+## Mutations
+
+`python3 "$TMPDIR/attachments-mutations.py"` ran the focused
+`swift test --package-path native/apple --filter Attachment` suite for each
+mutation, required a failed assertion or thrown test error, and restored each
+source file in a finally block. All 13 mutations were caught:
+
+| Deliberately broken behavior | Result |
+| --- | --- |
+| Byte limit removed | Caught |
+| Side-length limit removed | Caught |
+| Pixel-count limit removed | Caught |
+| Dimension validation before upload removed | Caught |
+| HEIC result advertised as HEIC instead of JPEG | Caught |
+| Five-item draft limit removed | Caught |
+| Uploading/failed items allowed to send | Caught |
+| Remove keeps the item | Caught |
+| Retry never uploads | Caught |
+| Message attachment ids omitted | Caught |
+| Upload bearer omitted | Caught |
+| Uploaded bytes replaced with an empty body | Caught |
+| Mac image paste/drop entry point disabled | Caught |
+
+The first remove mutator produced invalid Swift; it was not counted. It was
+corrected to a compiling no-op remove and the assertions then failed.
+
+Initial full native gate passed: 217 tests in 28 suites, one existing known
+issue, 125 parity strings, Mac build and iPhone Simulator build. Final gate
+and Linux CI are recorded with the final branch SHA.
+
+Native captures are under
+`polish-audit/equipo-daily-driver/site/build/slice2/`:
+`iphone-composer.png`, `iphone-sent.png`, and `mac-drop.png`.
+The debug fixtures use the production composer, message views and API client
+with a fake transport. The Mac capture enters the same pasteboard handler as
+performDragOperation. No real account or screenshot permission is used.
+
+## Final contract check
+
+The rebased native gate passed 244 tests in 31 suites, the existing known issue,
+221 parity strings and both builds. A final comparison with attach.Inspect then
+found that native's initial text-extension list was narrower than the server:
+the server also accepts extensionless UTF-8 files and source files. A new
+`textDetectionMatchesServerInsteadOfRestrictingExtensions` test failed first.
+Native now uses the server's UTF-8/control-character rule, excludes misleading
+image/PDF suffixes from text fallback, and advertises JSON only when valid.
+
+`swift test --package-path native/apple --filter Attachment` then passed
+11 tests across three suites. Four further mutations, run by
+`python3 "$TMPDIR/attachments-text-mutations.py"`, each failed assertions and
+were restored: wrong fallback media type, removed control-character check,
+removed image-suffix check, and removed JSON validity check. Total: 17 caught
+mutations. This contract correction adds no copy.
+
+## Screenshot review polish
+
+The failed-upload sentence stays byte-identical. Its duplicate text button is
+now an arrow.clockwise icon beside remove, with a 44 by 44 point tap target and
+the reviewed read.retry accessibility label. Sent bubbles align the thumbnail
+tiles, filenames and message text to the same leading edge inside normal
+padding. An adaptive grid wraps when space is limited. The debug fixture now
+includes a portrait screenshot and a synthetic landscape JPEG to check mixed
+aspect ratios. Both fit side by side in the captured iPhone and Mac bubbles.
+
+All three requested screenshots were recaptured from this branch and inspected.
+The Mac capture uses day appearance. Final `native/scripts/check-native.sh`
+passed: 245 tests in 31 suites, one existing known issue, 221 parity strings,
+zero reference failures, and Mac plus iPhone Simulator builds. No server files
+changed. No new copy was added by these polish fixes.
+
+## Fable review follow-up
+
+Review of 69e059bc requested three P2 corrections and associated P3 polish.
+Slice 3 was paused before editing code. This follow-up remains on the published
+native/attachments branch, with new commits and no rebase.
+
+Image preparation now matches chat-attach.js: JPEG quality 0.85, long edge
+2560, orientation applied and transparency flattened onto white. HEIC/HEIF
+and TIFF are converted; other oversized images, including WebP, are converted;
+GIFs retain the web's exception. ImageIO creates only a bounded thumbnail,
+on the background preparation task. The server's 10 MiB/12000 px/40 MP limits
+apply to the upload. Local file reads use a separate 128 MiB input bound so
+large compressed photographs can be resized before the upload check.
+
+The new generated 8064 by 6048 HEIC test failed first with AttachmentFailure
+pixels. The large WebP fixture is a generated solid-colour 4096 by 2048 image
+(encoded with cwebp); both now become bounded JPEGs. The HEIC metadata test
+sets GPS and a private EXIF comment, verifies their removal, and checks a
+90-degree orientation transform. A small injected output limit tests the
+size check after conversion independently of compression ratios.
+
+Mac drag tests now send synthetic NSDraggingInfo through draggingEntered,
+draggingUpdated, prepareForDragOperation and performDragOperation. They first
+failed for PNG/TIFF at the update and prepare stages. All four stages now
+accept supported image/file/promise types and refuse web URLs. Promised files
+are received through NSFilePromiseReceiver into a mode-0700 temporary directory,
+read inside its coordinated callback, and removed. The draft retains the bytes
+for retry; the directory is removed when its readers release it. A receiver
+fixture verifies delivery and cleanup. Folders are refused before a draft item
+is created, using api.attachment_type.
+
+Removing an item and clearing a draft cancel the owned upload tasks. The
+cancellation test first failed with the original non-cancelling implementation.
+Thumbnail and original-preview image decoding also move to detached tasks,
+with 512/4096 pixel bounds and a cancellation check before updating UI state.
+
+The iPhone keeps the reviewed Paste menu item and accepts the system paste
+prompt, as explicitly permitted by the review. This choice keeps the attachment
+sources together in the menu. No new runtime copy is introduced.
+
+`swift test --package-path native/apple --filter Attachment` passed 25 tests
+across four suites after the review fixes. The updated loopback HTTP test also
+rejects a 307 upload redirect and a response exceeding the per-request cap.
+
+`python3 "$TMPDIR/attachments-review-mutations.py"` independently broke each
+of these 22 behaviors; each run failed an assertion or threw a test error and
+the source was restored in a finally block:
+
+| Mutation | Result |
+| --- | --- |
+| Source metadata retained in converted JPEG | Caught |
+| Orientation transform disabled | Caught |
+| Attachment read bearer omitted | Caught |
+| Upload delegate follows redirect | Caught |
+| Transport response cap removed | Caught |
+| Attachment client response cap removed | Caught |
+| Composer canSend guard removed | Caught |
+| Lost-project retry drops attachment ids | Caught |
+| Task-thread send accepts attachments | Caught |
+| Retry allowed while already uploading | Caught |
+| Late progress overwrites a ready item | Caught |
+| Retry generation check removed | Caught |
+| Server attachment codes use generic copy | Caught |
+| Bounded-file read size check removed | Caught |
+| Converted output size check removed | Caught |
+| Empty data accepted | Caught |
+| Mac pasteboard accepts web URLs | Caught |
+| Removal does not cancel the upload | Caught |
+| Full-size conversion instead of 2560 thumbnail | Caught |
+| Large WebP skips JPEG conversion | Caught |
+| draggingUpdated refuses image data | Caught |
+| prepareForDragOperation refuses image data | Caught |
+
+These are in addition to the original 17 mutations. Test scaffolding compile
+errors were corrected before running the mutations; no compiler failure is
+counted as a caught mutation.
+
+The capture exercise found a further iPhone presentation defect: PhotosPicker
+inside the transient Menu closed without opening its picker. The menu now
+sets a binding for a photosPicker modifier on the stable parent. The retained
+AttachmentSourceUITests test taps Attach, opens Photos, and requires the
+system Photos navigation bar. It uses the real app with its debug transport.
+The first capture harness showed the missing picker; the corrected capture
+shows Private Access to Photos, without requesting full-library access.
+
+General desktop automation lacked Accessibility permission and the standalone
+Mac XCTest runner could not start an automation session. No permissions were
+changed. The Mac screenshot fixture now runs all four drag destination methods
+with synthetic NSDraggingInfo before capturing, matching the regression test;
+it is not claimed as a physical mouse-drag capture.
+
+Final verification: `native/scripts/check-native.sh` passed 259 tests in 32
+suites (one pre-existing known issue), 221 parity strings, zero dead-reference
+failures, and both platform builds. Adding an explicit capture scheme initially
+hid XcodeGen's automatic EquipoPhone scheme; the app's original build scheme
+is now explicit too, and the full gate was rerun successfully.
+
+`xcodebuild -project EquipoPhone.xcodeproj -scheme AttachmentSources
+-destination 'platform=iOS Simulator,id=C86CAA29-B99C-40AB-84C4-DF7C74926904'
+-derivedDataPath ../build/Phone CODE_SIGNING_ALLOWED=NO test` passed its retained
+UI test. Its XCTest screenshots were exported with `xcresulttool export
+attachments`, inspected, and saved as `iphone-add-menu.png` and
+`iphone-photos-picker.png` beside the refreshed `mac-drop.png` in slice2.
+The Photos picker explicitly shows Oficina Equipo can access only selected
+items. Its Location Included system label describes the selected source;
+converted images drop metadata and the server strips location on every upload.
+
+## Security-scoped Files follow-up, 2026-11-26
+
+Fable's delta review found that the immediate folder check ran before iPhone
+fileImporter URLs entered security-scoped access. The draft now checks file
+metadata inside a balanced access window, before creating an item. Local URLs
+whose startAccessingSecurityScopedResource returns false remain supported.
+The later bounded read retains its own balanced access window. Folders still
+produce api.attachment_type immediately and never become retryable items.
+
+A fake resolver rejects metadata reads unless access is active. With the old
+ordering, `swift test --package-path native/apple --filter
+AttachmentFollowupTests` failed with three assertions: the file was refused
+and the access sequence was wrong for both files and folders. With the fix,
+both paths observe start, metadata, stop, and the file reaches the fake server.
+
+The Mac composer delegates ordinary text drags to NSTextView in all four
+callbacks. A real NSTextView baseline and synthetic NSDraggingInfo exercise
+entry, update, preparation and insertion; the original code failed six
+assertions, including actual text insertion. The controller clarified that
+web URLs must also insert as plain text, not be blocked. The URL drop test
+first failed five assertions against the explicit URL refusal. Both URL drops
+and actual NSTextView paste now insert the URL as text, with no draft item or
+upload request. PNG/TIFF, file URLs and file promises retain the attachment
+path. The paste test preserves and restores the system clipboard in memory
+within one synchronous scope; no clipboard contents are logged.
+
+Additional tests distinguish cancellation after preparation from the item's
+identity check, cancel every upload on clear, enforce 10 MiB for an image that
+is not resized, inspect the flattened JPEG's pixel color, reject a promised
+file outside its private directory, and require per-file deletion while a
+promise reader still holds the directory alive. This last test cannot pass
+merely because directory deinit eventually removes everything.
+
+`swift test --package-path native/apple --filter
+'AttachmentFollowupTests|MacAttachmentTests'` passed 13 tests in two suites.
+No new runtime copy or server changes are included.
+
+`python3 "$TMPDIR/attachments-followup-mutations.py"` mutates one guard at a
+time, runs the two suites above, requires a built test binary and an assertion
+failure, then restores the source in a finally block. Its cases are:
+
+| Mutation | Expected regression |
+| --- | --- |
+| Metadata before scoped access | Selected file refused; wrong access order |
+| clear does not cancel uploads | Both server operations remain active |
+| Cancellation check after preparation removed | Cancelled preparation uploads |
+| Unresized-image byte limit removed | Oversized PNG accepted |
+| White canvas fill removed | Transparent pixels become black |
+| Promise directory containment removed | Outside file enters draft |
+| Per-file promise removal removed | Delivered file remains during other reads |
+| Text draggingEntered refuses fallback | Entry differs from NSTextView |
+| Text draggingUpdated refuses fallback | Update differs from NSTextView |
+| Text prepareForDragOperation refuses fallback | Preparation refused |
+| Text performDragOperation refuses fallback | Text never inserted |
+| File-URL-only pasteboard filter removed | Web URL becomes an attachment instead of text |
+
+All 12 mutations were caught. After the URL behavior clarification, case 12
+was replaced with removal of the file-URL-only filter and rerun using
+`python3 "$TMPDIR/attachments-followup-mutations.py" 12`; it failed the URL
+text/attachment assertions. The other 11 mutations and their tests were
+unchanged. No compiler failure was counted as a caught mutation.
+
+Final `native/scripts/check-native.sh` passed after the URL clarification:
+268 tests in 33 suites, one pre-existing known issue, 221 byte-identical parity
+strings, zero dead-reference failures, and successful Mac and iPhone Simulator
+builds. The exact mutation script, failure logs and final gate log are retained
+with the slice2 evidence as `scoped-verification-evidence.tar.gz` and
+`scoped-native-gate.log`.
diff --git a/native/apple/Sources/EquipoActivity/Resources/Localizable.xcstrings b/native/apple/Sources/EquipoActivity/Resources/Localizable.xcstrings
index 2835fe1f..f32fe8ad 100644
--- a/native/apple/Sources/EquipoActivity/Resources/Localizable.xcstrings
+++ b/native/apple/Sources/EquipoActivity/Resources/Localizable.xcstrings
@@ -145,6 +145,61 @@
}
}
},
+ "api.attachment_heic": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "HEIC photos cannot be read yet. Share it as a JPEG and try again."
+ }
+ }
+ }
+ },
+ "api.attachment_limit": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Too many files are waiting to send. Send or remove some first."
+ }
+ }
+ }
+ },
+ "api.attachment_pixels": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "That image is too large: at most 12,000 pixels on a side and 40 megapixels."
+ }
+ }
+ }
+ },
+ "api.attachment_too_large": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "That file is over 10 MB."
+ }
+ }
+ }
+ },
+ "api.attachment_type": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Equipo takes images (PNG, JPEG, WebP, GIF) and text, Markdown, CSV, JSON, log and PDF files."
+ }
+ }
+ }
+ },
"api.card_answered": {
"extractionState": "manual",
"localizations": {
@@ -464,6 +519,94 @@
}
}
},
+ "chat.attach.add": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Attach"
+ }
+ }
+ }
+ },
+ "chat.attach.failed": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Could not upload. Try again."
+ }
+ }
+ }
+ },
+ "chat.attach.file": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "File"
+ }
+ }
+ }
+ },
+ "chat.attach.image": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Photo or image"
+ }
+ }
+ }
+ },
+ "chat.attach.list": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Attachments"
+ }
+ }
+ }
+ },
+ "chat.attach.remove": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Remove %@"
+ }
+ }
+ }
+ },
+ "chat.attach.too_many": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "At most 5 files in one message."
+ }
+ }
+ }
+ },
+ "chat.attach.uploading": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Uploading…"
+ }
+ }
+ }
+ },
"chat.card.answer": {
"extractionState": "manual",
"localizations": {
@@ -1058,6 +1201,61 @@
}
}
},
+ "native.attach.camera": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Camera"
+ }
+ }
+ }
+ },
+ "native.attach.camera_usage": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Use your camera to take a photo to attach to your message."
+ }
+ }
+ }
+ },
+ "native.attach.files": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Files"
+ }
+ }
+ }
+ },
+ "native.attach.paste": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Paste"
+ }
+ }
+ }
+ },
+ "native.attach.photos": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Photos"
+ }
+ }
+ }
+ },
"native.step.log_tail": {
"extractionState": "manual",
"localizations": {
diff --git a/native/apple/Sources/EquipoKit/API/Attachments.swift b/native/apple/Sources/EquipoKit/API/Attachments.swift
new file mode 100644
index 00000000..a09bf647
--- /dev/null
+++ b/native/apple/Sources/EquipoKit/API/Attachments.swift
@@ -0,0 +1,36 @@
+import Foundation
+
+public struct MessageAttachment: Codable, Sendable, Equatable, Identifiable {
+ public let id: String
+ public let revision: Int64
+ public let kind: String
+ public let name: String
+ public let mediaType: String
+ public let size: Int64
+ public let sha256: String
+ public let width: Int
+ public let height: Int
+ public let messageId: String
+ public let createdAt: Date
+}
+
+extension EquipoClient {
+ public func upload(_ file: AttachmentFile, progress: @escaping @Sendable (Double) -> Void) async throws -> MessageAttachment {
+ var request = APIRequest("POST", "/attachments", body: file.data, bearer: token)
+ request.contentType = file.mediaType
+ let escaped = file.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? "file"
+ request.contentDisposition = "attachment; filename*=UTF-8''" + escaped
+ request.uploadProgress = UploadProgress(progress)
+ return try await send(request)
+ }
+
+ public func attachmentData(_ id: String, preview: Bool = false) async throws -> Data {
+ let id = id.addingPercentEncoding(withAllowedCharacters: .alphanumerics.union(CharacterSet(charactersIn: "_-"))) ?? ""
+ var request = APIRequest("GET", "/attachments/\(id)" + (preview ? "/preview" : ""), bearer: token)
+ request.maximumResponseBytes = AttachmentLimits.maxBytes
+ let response = try await transport.send(request)
+ guard (200..<300).contains(response.status) else { throw Self.error(response) }
+ guard response.data.count <= AttachmentLimits.maxBytes else { throw EquipoAPIError.tooLarge }
+ return response.data
+ }
+}
diff --git a/native/apple/Sources/EquipoKit/API/Client.swift b/native/apple/Sources/EquipoKit/API/Client.swift
index 82d6e233..374f6303 100644
--- a/native/apple/Sources/EquipoKit/API/Client.swift
+++ b/native/apple/Sources/EquipoKit/API/Client.swift
@@ -46,10 +46,12 @@ public struct EquipoClient: Sendable {
// MARK: Writes. Each takes a PendingWrite so a retry is the same request.
/// A message; the engine takes its key in the body as well as the header.
- public static func message(_ text: String, projectID: String? = nil) throws -> PendingWrite {
+ public static func message(_ text: String, projectID: String? = nil, attachments: [String] = []) throws -> PendingWrite {
let key = UUID().uuidString.lowercased()
- var body = ["text": text, "idempotency_key": key]
- if let projectID { body["project_id"] = projectID }
+ var body: [String: AnyEncodable] = ["text": .init(text), "idempotency_key": .init(key)]
+ guard attachments.count <= AttachmentLimits.maxCount, Set(attachments).count == attachments.count else { throw EquipoAPIError.status(422) }
+ if let projectID { body["project_id"] = .init(projectID) }
+ if !attachments.isEmpty { body["attachments"] = .init(attachments) }
return PendingWrite(body: try EquipoJSON.encoder.encode(body), key: key)
}
public func send(_ write: PendingWrite) async throws -> Sent { try await post("/messages", write) }
diff --git a/native/apple/Sources/EquipoKit/API/Thin.swift b/native/apple/Sources/EquipoKit/API/Thin.swift
index 021878c5..df16c7d6 100644
--- a/native/apple/Sources/EquipoKit/API/Thin.swift
+++ b/native/apple/Sources/EquipoKit/API/Thin.swift
@@ -16,6 +16,7 @@ public struct ThinMe: Codable, Sendable, Equatable {
}
public struct ThinMessage: Codable, Sendable, Identifiable, Equatable {
+ public var attachments: [MessageAttachment]? = nil
public var projectId: String? = nil
public var id: String
public var revision: Int64
diff --git a/native/apple/Sources/EquipoKit/API/Transport.swift b/native/apple/Sources/EquipoKit/API/Transport.swift
index e7501610..60403085 100644
--- a/native/apple/Sources/EquipoKit/API/Transport.swift
+++ b/native/apple/Sources/EquipoKit/API/Transport.swift
@@ -11,6 +11,10 @@ public struct APIRequest: Sendable, Equatable {
public var idempotencyKey: String?
public var ifMatch: Int64?
public var nativeSession: NativeSession?
+ var contentType = "application/json"
+ var contentDisposition: String?
+ var uploadProgress: UploadProgress?
+ var maximumResponseBytes = 4 * 1024 * 1024
public init(_ method: String, _ path: String, query: [URLQueryItem] = [], body: Data? = nil,
bearer: String? = nil, idempotencyKey: String? = nil, ifMatch: Int64? = nil, nativeSession: NativeSession? = nil) {
@@ -34,8 +38,9 @@ public struct APIRequest: Sendable, Equatable {
r.setValue("application/json", forHTTPHeaderField: "Accept")
if let body {
r.httpBody = body
- r.setValue("application/json", forHTTPHeaderField: "Content-Type")
+ r.setValue(contentType, forHTTPHeaderField: "Content-Type")
}
+ if let contentDisposition { r.setValue(contentDisposition, forHTTPHeaderField: "Content-Disposition") }
if let nativeSession {
// Only the bridge may send a cookie. Engine and pairing requests
// stay bearer-only, including after renewal.
@@ -96,12 +101,16 @@ public final class URLSessionTransport: NSObject, EquipoTransport, URLSessionTas
}
public func send(_ request: APIRequest) async throws -> APIResponse {
- let r = try request.urlRequest(origin: origin)
+ var r = try request.urlRequest(origin: origin)
do {
- let (data, response) = try await session.data(for: r)
+ let data: Data, response: URLResponse
+ if let progress = request.uploadProgress, let body = request.body {
+ r.httpBody = nil
+ (data, response) = try await session.upload(for: r, from: body, delegate: UploadDelegate(progress))
+ } else { (data, response) = try await session.data(for: r) }
guard let http = response as? HTTPURLResponse else { throw EquipoAPIError.offline }
observe(.responded(status: http.statusCode))
- guard data.count <= Self.maxBytes else { throw EquipoAPIError.tooLarge }
+ guard data.count <= request.maximumResponseBytes else { throw EquipoAPIError.tooLarge }
return APIResponse(status: http.statusCode, data: data)
} catch let error as URLError where error.code == .cancelled {
// This app stopped asking (the stream closed, pairing cancelled):
diff --git a/native/apple/Sources/EquipoKit/API/UploadProgress.swift b/native/apple/Sources/EquipoKit/API/UploadProgress.swift
new file mode 100644
index 00000000..459508e7
--- /dev/null
+++ b/native/apple/Sources/EquipoKit/API/UploadProgress.swift
@@ -0,0 +1,17 @@
+import Foundation
+
+/// Request-local progress survives the lifetime and credential-renewal wrappers.
+final class UploadProgress: Sendable, Equatable {
+ let report: @Sendable (Double) -> Void
+ init(_ report: @escaping @Sendable (Double) -> Void) { self.report = report }
+ static func == (lhs: UploadProgress, rhs: UploadProgress) -> Bool { lhs === rhs }
+}
+
+final class UploadDelegate: NSObject, URLSessionTaskDelegate, Sendable {
+ let progress: UploadProgress
+ init(_ progress: UploadProgress) { self.progress = progress }
+ func urlSession(_ session: URLSession, task: URLSessionTask, didSendBodyData bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) {
+ if totalBytesExpectedToSend > 0 { progress.report(min(1, Double(totalBytesSent) / Double(totalBytesExpectedToSend))) }
+ }
+ func urlSession(_ session: URLSession, task: URLSessionTask, willPerformHTTPRedirection response: HTTPURLResponse, newRequest request: URLRequest) async -> URLRequest? { nil }
+}
diff --git a/native/apple/Sources/EquipoKit/Attachments/AttachmentDraft.swift b/native/apple/Sources/EquipoKit/Attachments/AttachmentDraft.swift
new file mode 100644
index 00000000..2e404c37
--- /dev/null
+++ b/native/apple/Sources/EquipoKit/Attachments/AttachmentDraft.swift
@@ -0,0 +1,88 @@
+import Foundation
+import Observation
+
+@MainActor @Observable public final class AttachmentDraft {
+ public struct Item: Identifiable, Sendable {
+ public enum State: Sendable { case uploading(Double), ready(MessageAttachment), failed(String) }
+ public let id: UUID
+ public let name: String
+ public var state: State
+ public var file: AttachmentFile?
+ var generation = UUID()
+ var source: Source
+ public var failure: String? { if case .failed(let words) = state { return words }; return nil }
+ }
+ enum Source: Sendable { case data(Data), file(URL), load(@Sendable () async throws -> Data) }
+ public private(set) var items: [Item] = []
+ public private(set) var notice: String?
+ @ObservationIgnored private var uploads: [UUID: (generation: UUID, task: Task<Void, Never>)] = [:]
+ @ObservationIgnored var fileAccess: any AttachmentFileAccess = SystemAttachmentFileAccess()
+ var client: EquipoClient
+ public init(client: EquipoClient) { self.client = client }
+
+ public var readyAttachments: [MessageAttachment] { items.compactMap { if case .ready(let value) = $0.state { return value }; return nil } }
+ public func canSend(text: String) -> Bool {
+ items.allSatisfy { if case .ready = $0.state { return true }; return false } && (!text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty || !items.isEmpty)
+ }
+ public func add(data: Data, name: String) async { await add(.data(data), name: name) }
+ public func add(name: String, load: @escaping @Sendable () async throws -> Data) async { await add(.load(load), name: name) }
+ public func refuseFile() { notice = AttachmentFailure.type.words }
+ public func add(url: URL) async {
+ do { try AttachmentFile.checkRegularFile(url, access: fileAccess) }
+ catch { refuseFile(); return }
+ await add(.file(url), name: url.lastPathComponent)
+ }
+ private func add(_ source: Source, name: String) async {
+ guard items.count < AttachmentLimits.maxCount else { notice = EquipoStrings.text("chat.attach.too_many"); return }
+ notice = nil
+ let id = UUID()
+ items.append(Item(id: id, name: name, state: .uploading(0), source: source))
+ await upload(id)
+ }
+ public func remove(_ id: UUID) { uploads.removeValue(forKey: id)?.task.cancel(); items.removeAll { $0.id == id }; notice = nil }
+ public func clear() { for upload in uploads.values { upload.task.cancel() }; uploads = [:]; items = []; notice = nil }
+ public func retry(_ id: UUID) async {
+ guard let i = items.firstIndex(where: { $0.id == id }), items[i].failure != nil else { return }
+ items[i].generation = UUID(); items[i].state = .uploading(0)
+ await upload(id)
+ }
+ private func upload(_ id: UUID) async {
+ guard let generation = items.first(where: { $0.id == id })?.generation else { return }
+ let task = Task { await performUpload(id) }
+ uploads[id] = (generation, task)
+ await withTaskCancellationHandler { await task.value } onCancel: { task.cancel() }
+ if uploads[id]?.generation == generation { uploads[id] = nil }
+ }
+ private func performUpload(_ id: UUID) async {
+ guard let item = items.first(where: { $0.id == id }) else { return }
+ do {
+ let file = try await Task.detached {
+ let bytes: Data
+ switch item.source { case .data(let data): bytes = data; case .file(let url): bytes = try AttachmentFile.read(url); case .load(let load): bytes = try await load() }
+ return try AttachmentFile.prepare(bytes, name: item.name)
+ }.value
+ try Task.checkCancellation()
+ guard let i = index(id, item.generation) else { return }
+ items[i].file = file
+ let attachment = try await client.upload(file) { [weak self] fraction in
+ Task { @MainActor [weak self] in
+ guard let self, let i = self.index(id, item.generation), case .uploading = self.items[i].state else { return }
+ self.items[i].state = .uploading(fraction)
+ }
+ }
+ guard let i = index(id, item.generation) else { return }
+ items[i].state = .ready(attachment)
+ } catch {
+ guard let i = index(id, item.generation) else { return }
+ let words: String
+ if let failure = error as? AttachmentFailure { words = failure.words }
+ else if let error = error as? EquipoAPIError, let code = error.code,
+ ["attachment_too_large", "attachment_pixels", "attachment_type", "attachment_heic", "attachment_limit"].contains(code) {
+ words = EquipoStrings.text(String.LocalizationValue("api." + code))
+ }
+ else { words = EquipoStrings.text("chat.attach.failed") }
+ items[i].state = .failed(words)
+ }
+ }
+ private func index(_ id: UUID, _ generation: UUID) -> Int? { items.firstIndex { $0.id == id && $0.generation == generation } }
+}
diff --git a/native/apple/Sources/EquipoKit/Attachments/AttachmentFile.swift b/native/apple/Sources/EquipoKit/Attachments/AttachmentFile.swift
new file mode 100644
index 00000000..7d759a64
--- /dev/null
+++ b/native/apple/Sources/EquipoKit/Attachments/AttachmentFile.swift
@@ -0,0 +1,117 @@
+import Foundation
+import ImageIO
+import UniformTypeIdentifiers
+
+/// POST /attachments' v1 contract (internal/attach/attach.go). /capabilities
+/// publishes authentication/version support, not configurable upload limits.
+public enum AttachmentLimits {
+ public static let maxBytes = 10 << 20
+ // Bound local file reads before thumbnailing, independently of the upload cap.
+ static let maxInputBytes = 128 << 20
+ static let imageLongEdge = 2560
+ public static let maxCount = 5
+ public static let maxSide = 12_000
+ public static let maxPixels = 40_000_000
+ static func checkDimensions(width: Int, height: Int) throws {
+ guard width > 0, height > 0 else { throw AttachmentFailure.type }
+ guard width <= maxSide, height <= maxSide, width * height <= maxPixels else { throw AttachmentFailure.pixels }
+ }
+}
+
+public enum AttachmentFailure: Error, Equatable, Sendable {
+ case tooLarge, pixels, type
+ public var words: String {
+ switch self {
+ case .tooLarge: EquipoStrings.text("api.attachment_too_large")
+ case .pixels: EquipoStrings.text("api.attachment_pixels")
+ case .type: EquipoStrings.text("api.attachment_type")
+ }
+ }
+}
+
+protocol AttachmentFileAccess: Sendable {
+ func start(_ url: URL) -> Bool
+ func stop(_ url: URL)
+ func isRegularFile(_ url: URL) throws -> Bool
+}
+
+struct SystemAttachmentFileAccess: AttachmentFileAccess {
+ func start(_ url: URL) -> Bool { url.startAccessingSecurityScopedResource() }
+ func stop(_ url: URL) { url.stopAccessingSecurityScopedResource() }
+ func isRegularFile(_ url: URL) throws -> Bool { try url.resourceValues(forKeys: [.isRegularFileKey]).isRegularFile == true }
+}
+
+public struct AttachmentFile: Sendable {
+ public let data: Data
+ public let name: String
+ public let mediaType: String
+ public let width: Int
+ public let height: Int
+
+ public static func prepare(_ data: Data, name: String) throws -> Self {
+ try prepare(data, name: name, maximumBytes: AttachmentLimits.maxBytes)
+ }
+
+ static func prepare(_ data: Data, name: String, maximumBytes: Int) throws -> Self {
+ guard !data.isEmpty else { throw AttachmentFailure.type }
+ let name = URL(fileURLWithPath: name).lastPathComponent
+ if let source = CGImageSourceCreateWithData(data as CFData, [kCGImageSourceShouldCache: false] as CFDictionary),
+ let typeID = CGImageSourceGetType(source) as String?, let type = UTType(typeID), type.conforms(to: .image) {
+ let properties = CGImageSourceCopyPropertiesAtIndex(source, 0, nil) as? [CFString: Any]
+ let width = (properties?[kCGImagePropertyPixelWidth] as? NSNumber)?.intValue ?? 0
+ let height = (properties?[kCGImagePropertyPixelHeight] as? NSNumber)?.intValue ?? 0
+ guard width > 0, height > 0 else { throw AttachmentFailure.type }
+ if type.conforms(to: .heic) || type.conforms(to: .heif) || type == .tiff || (type != .gif && max(width, height) > AttachmentLimits.imageLongEdge) {
+ // TIFF is the Mac clipboard's native image representation.
+ // Apply orientation and omit source metadata, including location.
+ let options: [CFString: Any] = [kCGImageSourceCreateThumbnailFromImageAlways: true, kCGImageSourceCreateThumbnailWithTransform: true, kCGImageSourceThumbnailMaxPixelSize: AttachmentLimits.imageLongEdge, kCGImageSourceShouldCacheImmediately: true]
+ guard let image = CGImageSourceCreateThumbnailAtIndex(source, 0, options as CFDictionary) else { throw AttachmentFailure.type }
+ // The web canvas flattens transparency on white before JPEG encoding.
+ guard let canvas = CGContext(data: nil, width: image.width, height: image.height, bitsPerComponent: 8, bytesPerRow: 0, space: CGColorSpaceCreateDeviceRGB(), bitmapInfo: CGImageAlphaInfo.noneSkipLast.rawValue) else { throw AttachmentFailure.type }
+ canvas.setFillColor(CGColor(gray: 1, alpha: 1)); canvas.fill(CGRect(x: 0, y: 0, width: image.width, height: image.height))
+ canvas.draw(image, in: CGRect(x: 0, y: 0, width: image.width, height: image.height))
+ guard let flattened = canvas.makeImage() else { throw AttachmentFailure.type }
+ let output = NSMutableData()
+ guard let destination = CGImageDestinationCreateWithData(output, UTType.jpeg.identifier as CFString, 1, nil) else { throw AttachmentFailure.type }
+ CGImageDestinationAddImage(destination, flattened, [kCGImageDestinationLossyCompressionQuality: 0.85] as CFDictionary)
+ guard CGImageDestinationFinalize(destination) else { throw AttachmentFailure.type }
+ guard output.length <= maximumBytes else { throw AttachmentFailure.tooLarge }
+ return Self(data: output as Data, name: (name as NSString).deletingPathExtension + ".jpg", mediaType: "image/jpeg", width: image.width, height: image.height)
+ }
+ try AttachmentLimits.checkDimensions(width: width, height: height)
+ guard data.count <= maximumBytes else { throw AttachmentFailure.tooLarge }
+ let types: [UTType: String] = [.png: "image/png", .jpeg: "image/jpeg", .gif: "image/gif", .webP: "image/webp"]
+ guard let media = types[type] else { throw AttachmentFailure.type }
+ let suffix = type.preferredFilenameExtension ?? "png"
+ return Self(data: data, name: (name as NSString).deletingPathExtension + "." + suffix, mediaType: media, width: width, height: height)
+ }
+ guard data.count <= maximumBytes else { throw AttachmentFailure.tooLarge }
+ if data.starts(with: Data("%PDF-".utf8)) { return Self(data: data, name: name, mediaType: "application/pdf", width: 0, height: 0) }
+ let suffix = (name as NSString).pathExtension.lowercased()
+ guard !["png", "jpg", "jpeg", "gif", "webp", "heic", "heif", "hif", "pdf"].contains(suffix),
+ let text = String(data: data, encoding: .utf8),
+ text.unicodeScalars.allSatisfy({ $0.value >= 32 && $0.value != 127 || [9, 10, 12, 13].contains($0.value) })
+ else { throw AttachmentFailure.type }
+ // The server accepts UTF-8 source files and extensionless files too.
+ var media = ["md": "text/markdown", "markdown": "text/markdown", "csv": "text/csv"][suffix] ?? "text/plain"
+ if suffix == "json", (try? JSONSerialization.jsonObject(with: data, options: .fragmentsAllowed)) != nil { media = "application/json" }
+ return Self(data: data, name: name, mediaType: media, width: 0, height: 0)
+ }
+
+ static func checkRegularFile(_ url: URL, access: any AttachmentFileAccess) throws {
+ guard url.isFileURL else { throw AttachmentFailure.type }
+ let started = access.start(url)
+ defer { if started { access.stop(url) } }
+ guard try access.isRegularFile(url) else { throw AttachmentFailure.type }
+ }
+
+ public static func read(_ url: URL) throws -> Data {
+ let access = url.startAccessingSecurityScopedResource()
+ defer { if access { url.stopAccessingSecurityScopedResource() } }
+ let handle = try FileHandle(forReadingFrom: url)
+ defer { try? handle.close() }
+ let data = try handle.read(upToCount: AttachmentLimits.maxInputBytes + 1) ?? Data()
+ guard data.count <= AttachmentLimits.maxInputBytes else { throw AttachmentFailure.tooLarge }
+ return data
+ }
+}
diff --git a/native/apple/Sources/EquipoKit/Attachments/AttachmentViews.swift b/native/apple/Sources/EquipoKit/Attachments/AttachmentViews.swift
new file mode 100644
index 00000000..05025fce
--- /dev/null
+++ b/native/apple/Sources/EquipoKit/Attachments/AttachmentViews.swift
@@ -0,0 +1,177 @@
+import SwiftUI
+import ImageIO
+import PDFKit
+
+/// Shared composer attachment list. State belongs to the session's draft.
+public struct AttachmentDraftStrip: View {
+ let draft: AttachmentDraft
+ public init(draft: AttachmentDraft) { self.draft = draft }
+ public var body: some View {
+ VStack(alignment: .leading, spacing: 6) {
+ if !draft.items.isEmpty {
+ ScrollView(.horizontal) {
+ HStack(alignment: .top, spacing: 12) {
+ ForEach(draft.items) { item in
+ VStack(alignment: .leading, spacing: 4) {
+ ZStack(alignment: .topTrailing) {
+ AttachmentPicture(data: item.file?.data, name: item.name)
+ .frame(width: 140, height: 86).background(Palette.surface2)
+ .clipShape(.rect(cornerRadius: 8))
+ HStack(spacing: 0) {
+ if item.failure != nil {
+ Button { Task { await draft.retry(item.id) } } label: {
+ Image(systemName: "arrow.clockwise")
+ .font(.system(size: 14, weight: .semibold))
+ .foregroundStyle(Palette.accent)
+ .padding(7).background(Palette.surface, in: Circle())
+ .frame(width: 44, height: 44).contentShape(Rectangle())
+ }
+ .buttonStyle(.plain)
+ .accessibilityLabel(EquipoStrings.text("read.retry"))
+ }
+ Button { draft.remove(item.id) } label: {
+ Image(systemName: "xmark.circle.fill").symbolRenderingMode(.palette)
+ .foregroundStyle(Palette.text, Palette.surface).frame(width: 44, height: 44).contentShape(Rectangle())
+ }
+ .buttonStyle(.plain)
+ .accessibilityLabel(String(format: EquipoStrings.text("chat.attach.remove"), item.name))
+ }
+ }
+ Text(item.name).font(Typo.caption).lineLimit(1).truncationMode(.middle)
+ switch item.state {
+ case .uploading(let progress):
+ ProgressView(value: progress).accessibilityLabel(EquipoStrings.text("chat.attach.uploading"))
+ Text(EquipoStrings.text("chat.attach.uploading")).font(Typo.caption).foregroundStyle(Palette.secondary)
+ case .failed(let words):
+ Text(words).font(Typo.caption).foregroundStyle(Palette.negative).fixedSize(horizontal: false, vertical: true)
+ case .ready: EmptyView()
+ }
+ }.frame(width: 140, alignment: .leading)
+ }
+ }.padding(.vertical, 4)
+ }
+ .accessibilityLabel(EquipoStrings.text("chat.attach.list"))
+ }
+ if let notice = draft.notice { Text(notice).font(Typo.caption).foregroundStyle(Palette.negative) }
+ }
+ }
+}
+
+struct AttachmentPicture: View {
+ let data: Data?
+ let name: String
+ @State private var image: CGImage?
+ var body: some View {
+ Group {
+ if let image {
+ Image(decorative: image, scale: 1).resizable().scaledToFit().accessibilityLabel(name)
+ } else {
+ Image(systemName: "doc").font(.title2).foregroundStyle(Palette.secondary).accessibilityLabel(name)
+ }
+ }.task(id: data) {
+ let bytes = data
+ let decoded = await Task.detached { bytes.flatMap { Self.thumbnail($0, side: 512) } }.value
+ guard !Task.isCancelled else { return }
+ image = decoded
+ }
+ }
+ nonisolated static func thumbnail(_ data: Data, side: Int) -> CGImage? {
+ guard let source = CGImageSourceCreateWithData(data as CFData, [kCGImageSourceShouldCache: false] as CFDictionary) else { return nil }
+ return CGImageSourceCreateThumbnailAtIndex(source, 0, [kCGImageSourceCreateThumbnailFromImageAlways: true, kCGImageSourceCreateThumbnailWithTransform: true, kCGImageSourceThumbnailMaxPixelSize: side] as CFDictionary)
+ }
+}
+
+/// Sent thumbnails use authenticated API reads, never bare remote-image URLs.
+public struct MessageAttachments: View {
+ let attachments: [MessageAttachment]
+ let client: EquipoClient
+ @State private var selected: MessageAttachment?
+ public init(_ attachments: [MessageAttachment], client: EquipoClient) {
+ self.attachments = attachments; self.client = client
+ }
+ public var body: some View {
+ LazyVGrid(columns: [GridItem(.adaptive(minimum: 120, maximum: 180), alignment: .leading)], alignment: .leading, spacing: 8) {
+ ForEach(attachments) { file in
+ Button { selected = file } label: { SentAttachmentTile(file: file, client: client) }
+ .buttonStyle(.plain).accessibilityLabel(file.name)
+ }
+ }
+ #if os(iOS)
+ .fullScreenCover(item: $selected) { AttachmentPreview(file: $0, client: client) }
+ #else
+ .sheet(item: $selected) { AttachmentPreview(file: $0, client: client).frame(minWidth: 600, minHeight: 500) }
+ #endif
+ }
+}
+
+private struct SentAttachmentTile: View {
+ let file: MessageAttachment
+ let client: EquipoClient
+ @State private var data: Data?
+ var body: some View {
+ VStack(alignment: .leading, spacing: 4) {
+ AttachmentPicture(data: data, name: file.name).frame(height: 100).frame(maxWidth: .infinity)
+ .background(Palette.surface2).clipShape(.rect(cornerRadius: 8))
+ Text(file.name).font(Typo.caption).lineLimit(1).truncationMode(.middle).frame(maxWidth: .infinity, alignment: .leading)
+ }
+ .task(id: file.id) {
+ if file.kind == "image" { data = try? await client.attachmentData(file.id, preview: true) }
+ }
+ }
+}
+
+private struct AttachmentPreview: View {
+ let file: MessageAttachment
+ let client: EquipoClient
+ @Environment(\.dismiss) private var dismiss
+ @State private var data: Data?
+ @State private var failure = false
+ @State private var image: CGImage?
+ var body: some View {
+ NavigationStack {
+ Group {
+ if let data {
+ if let image {
+ ScrollView([.horizontal, .vertical]) {
+ Image(decorative: image, scale: 1).resizable().scaledToFit()
+ .containerRelativeFrame(.horizontal).accessibilityLabel(file.name)
+ }
+ } else if file.mediaType == "application/pdf" { AttachmentPDF(data: data) }
+ else { ScrollView { Text(String(decoding: data, as: UTF8.self)).font(.system(.body, design: .monospaced)).textSelection(.enabled).padding() } }
+ } else if failure {
+ VStack {
+ Text(EquipoStrings.text("read.failed_title"))
+ Button(EquipoStrings.text("read.retry")) { Task { await load() } }
+ }
+ } else { ProgressView().accessibilityLabel(file.name) }
+ }
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ .background(Palette.background).navigationTitle(file.name)
+ .toolbar { ToolbarItem(placement: .confirmationAction) { Button(EquipoStrings.text("team.close")) { dismiss() } } }
+ }.task { await load() }
+ }
+ private func load() async {
+ failure = false
+ do {
+ let bytes = try await client.attachmentData(file.id)
+ let decoded = await Task.detached { AttachmentPicture.thumbnail(bytes, side: 4096) }.value
+ guard !Task.isCancelled else { return }
+ image = decoded; data = bytes
+ }
+ catch { failure = true }
+ }
+}
+
+#if os(iOS)
+private struct AttachmentPDF: UIViewRepresentable {
+ let data: Data
+ func makeUIView(context: Context) -> PDFView { let view = PDFView(); view.autoScales = true; view.document = PDFDocument(data: data); return view }
+ func updateUIView(_ view: PDFView, context: Context) {}
+}
+#else
+private struct AttachmentPDF: NSViewRepresentable {
+ let data: Data
+ func makeNSView(context: Context) -> PDFView { let view = PDFView(); view.autoScales = true; view.document = PDFDocument(data: data); return view }
+ func updateNSView(_ view: PDFView, context: Context) {}
+}
+#endif
diff --git a/native/apple/Sources/EquipoKit/Attachments/AttachmentsFixture.swift b/native/apple/Sources/EquipoKit/Attachments/AttachmentsFixture.swift
new file mode 100644
index 00000000..ee5b7779
--- /dev/null
+++ b/native/apple/Sources/EquipoKit/Attachments/AttachmentsFixture.swift
@@ -0,0 +1,96 @@
+#if DEBUG
+import SwiftUI
+import ImageIO
+import UniformTypeIdentifiers
+import CoreText
+
+/// Offline visual fixture: no saved account, keychain or real server.
+public struct AttachmentsFixture: View {
+ @State private var session = Self.makeSession()
+ public init() {}
+ public var body: some View {
+ NavigationStack {
+ ConversationScreen(session: session) { _ in }
+ .navigationTitle(EquipoStrings.text("tab.conversation"))
+ #if os(iOS)
+ .navigationBarTitleDisplayMode(.inline)
+ #endif
+ }.task {
+ await session.refresh()
+ if ProcessInfo.processInfo.environment["EQUIPO_ATTACHMENTS_FIXTURE"] != "sent" {
+ await Self.seedDraft(session)
+ }
+ }
+ }
+ public static func makeSession() -> EquipoSession {
+ let transport = AttachmentFixtureTransport()
+ var account = DeviceAccount.new(origin: transport.origin, label: "Fixture")
+ account.credential = DeviceCredential(id: "fixture", token: "fixture", audience: "equipo.person.v1", instanceId: "fixture", expiresAt: .distantFuture)
+ return EquipoSession(account: account, accounts: DeviceAccounts(store: MemorySecretStore()), transport: transport)
+ }
+ public static func seedDraft(_ session: EquipoSession) async {
+ async let first: Void = session.attachments.add(data: image, name: "Home.png")
+ async let second: Void = session.attachments.add(data: image, name: "Home-failed.png")
+ _ = await (first, second)
+ }
+ /// Landscape JPEG fixture exercises mixed image aspect ratios in a sent bubble.
+ nonisolated public static var landscape: Data {
+ let context = CGContext(data: nil, width: 640, height: 360, bitsPerComponent: 8, bytesPerRow: 640 * 4, space: CGColorSpaceCreateDeviceRGB(), bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue)!
+ context.setFillColor(CGColor(red: 0.55, green: 0.76, blue: 0.9, alpha: 1)); context.fill(CGRect(x: 0, y: 0, width: 640, height: 360))
+ context.setFillColor(CGColor(red: 0.97, green: 0.88, blue: 0.56, alpha: 1)); context.fillEllipse(in: CGRect(x: 470, y: 245, width: 60, height: 60))
+ context.setFillColor(CGColor(red: 0.25, green: 0.46, blue: 0.37, alpha: 1))
+ context.move(to: CGPoint(x: 0, y: 0)); context.addLine(to: CGPoint(x: 0, y: 125)); context.addCurve(to: CGPoint(x: 640, y: 155), control1: CGPoint(x: 230, y: 320), control2: CGPoint(x: 340, y: 30)); context.addLine(to: CGPoint(x: 640, y: 0)); context.closePath(); context.fillPath()
+ let data = NSMutableData()
+ let destination = CGImageDestinationCreateWithData(data, UTType.jpeg.identifier as CFString, 1, nil)!
+ CGImageDestinationAddImage(destination, context.makeImage()!, nil); CGImageDestinationFinalize(destination)
+ return data as Data
+ }
+ nonisolated public static var image: Data {
+ let context = CGContext(data: nil, width: 360, height: 640, bitsPerComponent: 8, bytesPerRow: 360 * 4, space: CGColorSpaceCreateDeviceRGB(), bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue)!
+ context.setFillColor(CGColor(red: 0.98, green: 0.97, blue: 0.94, alpha: 1)); context.fill(CGRect(x: 0, y: 0, width: 360, height: 640))
+ context.setFillColor(CGColor(gray: 1, alpha: 1)); context.fill(CGRect(x: 20, y: 240, width: 320, height: 230))
+ func line(_ text: String, _ y: CGFloat, _ size: CGFloat) {
+ let value = NSAttributedString(string: text, attributes: [.font: CTFontCreateWithName("Helvetica" as CFString, size, nil), .foregroundColor: CGColor(gray: 0.15, alpha: 1)])
+ context.textPosition = CGPoint(x: 32, y: y); CTLineDraw(CTLineCreateWithAttributedString(value), context)
+ }
+ line("Home", 570, 30); line("Sign in", 425, 24); line("Your address", 370, 16)
+ context.setStrokeColor(CGColor(gray: 0.75, alpha: 1)); context.stroke(CGRect(x: 32, y: 305, width: 296, height: 42))
+ line("paul@example.com", 320, 16)
+ context.setFillColor(CGColor(red: 0.15, green: 0.32, blue: 0.8, alpha: 1)); context.fill(CGRect(x: 32, y: 240, width: 296, height: 42))
+ let data = NSMutableData()
+ let destination = CGImageDestinationCreateWithData(data, UTType.png.identifier as CFString, 1, nil)!
+ CGImageDestinationAddImage(destination, context.makeImage()!, nil); CGImageDestinationFinalize(destination)
+ return data as Data
+ }
+}
+
+private struct AttachmentFixtureTransport: EquipoTransport {
+ let origin = URL(string: "https://fixture.invalid")!
+ func send(_ request: APIRequest) async throws -> APIResponse {
+ if request.path == "/attachments" {
+ if request.contentDisposition?.contains("failed") == true { throw EquipoAPIError.offline }
+ request.uploadProgress?.report(0.42)
+ try await Task.sleep(for: .seconds(3600))
+ return APIResponse(status: 201, data: try JSONSerialization.data(withJSONObject: attachment))
+ }
+ if request.path.hasPrefix("/attachments/") { return APIResponse(status: 200, data: request.path.contains("at_landscape") ? AttachmentsFixture.landscape : AttachmentsFixture.image) }
+ let body: [String: Any]
+ switch request.path {
+ case "/snapshot":
+ body = ["me": ["id": "fixture", "address": "paul@example.com", "role": "owner", "team_id": "fixture", "team_name": "Oficina", "revision": 1], "cursor": 1, "tasks": [], "messages": messages, "turns": [], "cards": [], "projects": []]
+ default: body = ["items": []]
+ }
+ return APIResponse(status: 200, data: try JSONSerialization.data(withJSONObject: body))
+ }
+ func lines(_ request: APIRequest) async throws -> AsyncThrowingStream<String, Error> { AsyncThrowingStream { $0.finish() } }
+ private var attachment: [String: Any] {
+ ["id": "at_fixture", "revision": 1, "kind": "image", "name": "Home.png", "media_type": "image/png", "size": 8000, "sha256": "fixture", "width": 360, "height": 640, "message_id": "message", "created_at": "2026-11-25T10:51:00Z"]
+ }
+ private var landscapeAttachment: [String: Any] {
+ ["id": "at_landscape", "revision": 1, "kind": "image", "name": "Landscape.jpg", "media_type": "image/jpeg", "size": AttachmentsFixture.landscape.count, "sha256": "fixture", "width": 640, "height": 360, "message_id": "message", "created_at": "2026-11-25T10:51:00Z"]
+ }
+ private var messages: [[String: Any]] {
+ [["id": "message", "revision": 1, "role": "person", "text": "Home’s sign-in button is cut off on my phone.", "turn_id": "", "created_at": "2026-11-25T10:51:00Z", "attachments": [attachment, landscapeAttachment]]]
+ }
+}
+#endif
diff --git a/native/apple/Sources/EquipoKit/Attachments/PhoneAttachmentPicker.swift b/native/apple/Sources/EquipoKit/Attachments/PhoneAttachmentPicker.swift
new file mode 100644
index 00000000..0fbdfae3
--- /dev/null
+++ b/native/apple/Sources/EquipoKit/Attachments/PhoneAttachmentPicker.swift
@@ -0,0 +1,76 @@
+#if os(iOS)
+import SwiftUI
+import PhotosUI
+import UniformTypeIdentifiers
+
+struct PhoneAttachmentPicker: View {
+ let draft: AttachmentDraft
+ @State private var photos: [PhotosPickerItem] = []
+ @State private var choosingPhotos = false
+ @State private var files = false
+ @State private var camera = false
+ var body: some View {
+ Menu {
+ // COPY APPROVED: Luna, 2026-11-25, all native.attach.* source labels.
+ Button { choosingPhotos = true } label: {
+ Label(EquipoStrings.text("native.attach.photos"), systemImage: "photo")
+ }
+ if UIImagePickerController.isSourceTypeAvailable(.camera) {
+ Button { camera = true } label: { Label(EquipoStrings.text("native.attach.camera"), systemImage: "camera") }
+ }
+ Button { files = true } label: { Label(EquipoStrings.text("native.attach.files"), systemImage: "folder") }
+ Button { paste() } label: { Label(EquipoStrings.text("native.attach.paste"), systemImage: "document.on.clipboard") }
+ } label: {
+ Image(systemName: "plus").font(.system(size: 20)).frame(width: 44, height: 44)
+ }
+ .accessibilityLabel(EquipoStrings.text("chat.attach.add"))
+ .photosPicker(isPresented: $choosingPhotos, selection: $photos, maxSelectionCount: max(1, AttachmentLimits.maxCount - draft.items.count), matching: .images)
+ .fileImporter(isPresented: $files, allowedContentTypes: [.item], allowsMultipleSelection: true) { result in
+ if case .success(let urls) = result { for url in urls { Task { await draft.add(url: url) } } }
+ }
+ .fullScreenCover(isPresented: $camera) {
+ CameraAttachment { data in
+ camera = false
+ if let data { Task { await draft.add(data: data, name: "photo.jpg") } }
+ }.ignoresSafeArea()
+ }
+ .onChange(of: photos) { _, selected in
+ photos = []
+ for photo in selected {
+ Task {
+ await draft.add(name: "photo") {
+ guard let data = try await photo.loadTransferable(type: Data.self) else { throw AttachmentFailure.type }
+ return data
+ }
+ }
+ }
+ }
+ }
+ private func paste() {
+ let pasteboard = UIPasteboard.general
+ for type in [UTType.png, .jpeg, .heic, .heif, .gif, .webP, .tiff] {
+ if let data = pasteboard.data(forPasteboardType: type.identifier) {
+ Task { await draft.add(data: data, name: "image." + (type.preferredFilenameExtension ?? "png")) }; return
+ }
+ }
+ if let urls = pasteboard.urls { for url in urls where url.isFileURL { Task { await draft.add(url: url) } } }
+ }
+}
+
+private struct CameraAttachment: UIViewControllerRepresentable {
+ let completed: (Data?) -> Void
+ func makeCoordinator() -> Coordinator { Coordinator(completed: completed) }
+ func makeUIViewController(context: Context) -> UIImagePickerController {
+ let picker = UIImagePickerController(); picker.sourceType = .camera; picker.delegate = context.coordinator; return picker
+ }
+ func updateUIViewController(_ view: UIImagePickerController, context: Context) {}
+ final class Coordinator: NSObject, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
+ let completed: (Data?) -> Void
+ init(completed: @escaping (Data?) -> Void) { self.completed = completed }
+ func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { completed(nil) }
+ func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) {
+ completed((info[.originalImage] as? UIImage)?.jpegData(compressionQuality: 0.9))
+ }
+ }
+}
+#endif
diff --git a/native/apple/Sources/EquipoKit/Resources/Localizable.xcstrings b/native/apple/Sources/EquipoKit/Resources/Localizable.xcstrings
index 2835fe1f..f32fe8ad 100644
--- a/native/apple/Sources/EquipoKit/Resources/Localizable.xcstrings
+++ b/native/apple/Sources/EquipoKit/Resources/Localizable.xcstrings
@@ -145,6 +145,61 @@
}
}
},
+ "api.attachment_heic": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "HEIC photos cannot be read yet. Share it as a JPEG and try again."
+ }
+ }
+ }
+ },
+ "api.attachment_limit": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Too many files are waiting to send. Send or remove some first."
+ }
+ }
+ }
+ },
+ "api.attachment_pixels": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "That image is too large: at most 12,000 pixels on a side and 40 megapixels."
+ }
+ }
+ }
+ },
+ "api.attachment_too_large": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "That file is over 10 MB."
+ }
+ }
+ }
+ },
+ "api.attachment_type": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Equipo takes images (PNG, JPEG, WebP, GIF) and text, Markdown, CSV, JSON, log and PDF files."
+ }
+ }
+ }
+ },
"api.card_answered": {
"extractionState": "manual",
"localizations": {
@@ -464,6 +519,94 @@
}
}
},
+ "chat.attach.add": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Attach"
+ }
+ }
+ }
+ },
+ "chat.attach.failed": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Could not upload. Try again."
+ }
+ }
+ }
+ },
+ "chat.attach.file": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "File"
+ }
+ }
+ }
+ },
+ "chat.attach.image": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Photo or image"
+ }
+ }
+ }
+ },
+ "chat.attach.list": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Attachments"
+ }
+ }
+ }
+ },
+ "chat.attach.remove": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Remove %@"
+ }
+ }
+ }
+ },
+ "chat.attach.too_many": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "At most 5 files in one message."
+ }
+ }
+ }
+ },
+ "chat.attach.uploading": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Uploading…"
+ }
+ }
+ }
+ },
"chat.card.answer": {
"extractionState": "manual",
"localizations": {
@@ -1058,6 +1201,61 @@
}
}
},
+ "native.attach.camera": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Camera"
+ }
+ }
+ }
+ },
+ "native.attach.camera_usage": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Use your camera to take a photo to attach to your message."
+ }
+ }
+ }
+ },
+ "native.attach.files": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Files"
+ }
+ }
+ }
+ },
+ "native.attach.paste": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Paste"
+ }
+ }
+ }
+ },
+ "native.attach.photos": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Photos"
+ }
+ }
+ }
+ },
"native.step.log_tail": {
"extractionState": "manual",
"localizations": {
diff --git a/native/apple/Sources/EquipoKit/Session/EquipoSession.swift b/native/apple/Sources/EquipoKit/Session/EquipoSession.swift
index 44de5f95..c9fc5bf9 100644
--- a/native/apple/Sources/EquipoKit/Session/EquipoSession.swift
+++ b/native/apple/Sources/EquipoKit/Session/EquipoSession.swift
@@ -18,6 +18,7 @@ public final class EquipoSession {
public let id: String
public let text: String
public let taskID: String?
+ public var attachments: [MessageAttachment] = []
public var notice: String? = nil
public var projectName: String? = nil
public var state: State
@@ -50,6 +51,7 @@ public final class EquipoSession {
public private(set) var tasks: [ThinTask] = []
/// nil until loaded: an unknown count is not zero.
public private(set) var needsYou: [ThinTask]?
+ public let attachments: AttachmentDraft
public let projectCatalog: ProjectCatalog
public var projects: [String: ThinProject] { projectCatalog.projects }
public private(set) var answerNotices: [String: String] = [:]
@@ -88,6 +90,7 @@ public final class EquipoSession {
self.revocationTransport = transport
let client = EquipoClient(transport: LifetimeTransport(inner: transport, lifetime: lifetime), token: account.credential?.token)
self.client = client
+ attachments = AttachmentDraft(client: client)
projectCatalog = ProjectCatalog(client: client, lifetime: lifetime)
if !account.isUsable() { status = .signedOut }
}
@@ -332,14 +335,17 @@ public final class EquipoSession {
// MARK: Sending
public func sendFromComposer(_ text: String) -> Task<Void, Never> {
+ guard lifetime.isActive, attachments.canSend(text: text) else { return Task {} }
+ let files = attachments.readyAttachments
+ attachments.clear()
let projectID = projectCatalog.takeSelection()
- return Task { await send(text, projectID: projectID) }
+ return Task { await send(text, projectID: projectID, attachments: files) }
}
- public func send(_ text: String, inThreadOf taskID: String? = nil, projectID: String? = nil) async {
+ public func send(_ text: String, inThreadOf taskID: String? = nil, projectID: String? = nil, attachments: [MessageAttachment] = []) async {
let text = text.trimmingCharacters(in: .whitespacesAndNewlines)
- guard lifetime.isActive, !text.isEmpty, let write = try? EquipoClient.message(text, projectID: taskID == nil ? projectID : nil) else { return }
- outgoing.append(Outgoing(id: write.key, text: text, taskID: taskID, projectName: taskID == nil ? projectID.flatMap { projects[$0]?.displayName } : nil, state: .sending, write: write))
+ guard lifetime.isActive, !text.isEmpty || !attachments.isEmpty, taskID == nil || attachments.isEmpty, let write = try? EquipoClient.message(text, projectID: taskID == nil ? projectID : nil, attachments: attachments.map(\.id)) else { return }
+ outgoing.append(Outgoing(id: write.key, text: text, taskID: taskID, attachments: attachments, projectName: taskID == nil ? projectID.flatMap { projects[$0]?.displayName } : nil, state: .sending, write: write))
await deliver(write.key)
}
@@ -347,7 +353,7 @@ public final class EquipoSession {
public func retry(_ id: String) async {
if let i = outgoing.firstIndex(where: { $0.id == id }), outgoing[i].goneProject {
// A definitive 404 rejected this send. A changed body is a new operation.
- guard let write = try? EquipoClient.message(outgoing[i].text) else { return }
+ guard let write = try? EquipoClient.message(outgoing[i].text, attachments: outgoing[i].attachments.map(\.id)) else { return }
outgoing[i].write = write; outgoing[i].projectName = nil; outgoing[i].goneProject = false
}
await deliver(id)
@@ -384,8 +390,8 @@ public final class EquipoSession {
// A proxy 404, another API code, or a missing task is not evidence about that project.
if case .server(404, let body) = error, body.code == "not_found", body.copyKey == "api.not_found",
item.taskID == nil,
- let fields = try? JSONSerialization.jsonObject(with: item.write.body) as? [String: String],
- let project = fields["project_id"], !project.isEmpty {
+ let fields = try? JSONSerialization.jsonObject(with: item.write.body) as? [String: Any],
+ let project = fields["project_id"] as? String, !project.isEmpty {
outgoing[i].goneProject = true
outgoing[i].projectName = nil
outgoing[i].notice = EquipoStrings.text("projects.selection_lost")
@@ -496,6 +502,7 @@ public final class EquipoSession {
revocationTransport = transport
client = EquipoClient(transport: LifetimeTransport(inner: transport, lifetime: lifetime), token: account.credential?.token)
projectCatalog.client = client
+ attachments.client = client
if status == .signedOut { status = .loading }
}
@@ -510,6 +517,7 @@ public final class EquipoSession {
/// not prevent a completed network response from reaching persistence.
func invalidate() {
lifetime.end()
+ attachments.clear()
markdown.removeAll()
status = .signedOut
drafts = [:]
diff --git a/native/apple/Sources/EquipoKit/UI/RosterViews.swift b/native/apple/Sources/EquipoKit/UI/RosterViews.swift
index 79e81cc3..7eb801d1 100644
--- a/native/apple/Sources/EquipoKit/UI/RosterViews.swift
+++ b/native/apple/Sources/EquipoKit/UI/RosterViews.swift
@@ -562,14 +562,20 @@ public struct CoordinatorMessage: View {
}
struct OwnMessage: View {
let text: String
+ var attachments: [MessageAttachment] = []
+ var client: EquipoClient? = nil
var body: some View {
- Text(text).font(Typo.message).foregroundStyle(Palette.text).fixedSize(horizontal: false, vertical: true)
+ VStack(alignment: .leading, spacing: 8) {
+ if !attachments.isEmpty, let client { MessageAttachments(attachments, client: client) }
+ if !text.isEmpty { Text(text).font(Typo.message).foregroundStyle(Palette.text).fixedSize(horizontal: false, vertical: true)
+ .accessibilityLabel(Text(String(localized: "message.own_spoken \(text)", bundle: .module))) }
+ }
.padding(.horizontal, 14).padding(.vertical, 10)
.background(Palette.soft, in: RoundedRectangle(cornerRadius: 18, style: .continuous))
.overlay(RoundedRectangle(cornerRadius: 18, style: .continuous).strokeBorder(Palette.lightRim.opacity(0.7), lineWidth: 1))
.padding(.leading, 48)
.frame(maxWidth: .infinity, alignment: .trailing)
- .accessibilityLabel(Text(String(localized: "message.own_spoken \(text)", bundle: .module)))
+ .accessibilityElement(children: .contain)
}
}
/// One line: the mark, the real activity, elapsed time and a quiet Stop.
diff --git a/native/apple/Sources/EquipoKit/UI/Screens/ConversationScreen.swift b/native/apple/Sources/EquipoKit/UI/Screens/ConversationScreen.swift
index dce40e57..8db46c80 100644
--- a/native/apple/Sources/EquipoKit/UI/Screens/ConversationScreen.swift
+++ b/native/apple/Sources/EquipoKit/UI/Screens/ConversationScreen.swift
@@ -43,7 +43,7 @@ public struct ConversationScreen: View {
.safeAreaInset(edge: .bottom, spacing: 0) {
VStack(spacing: 0) {
ProjectSelectionChip(catalog: session.projectCatalog)
- Composer(placeholder: String(localized: "conversation.placeholder", bundle: .module)) { text in
+ Composer(placeholder: String(localized: "conversation.placeholder", bundle: .module), attachments: session.attachments) { text in
_ = sendFromComposer(text)
}
}
@@ -75,8 +75,8 @@ public struct ConversationScreen: View {
} else {
switch item {
case .draft, .coordinator, .notice: EmptyView()
- case .own(let m): OwnMessage(text: m.text)
- case .outgoing(let o): OutgoingMessage(item: o) { Task { await session.retry(o.id) } }
+ case .own(let m): OwnMessage(text: m.text, attachments: m.attachments ?? [], client: session.client)
+ case .outgoing(let o): OutgoingMessage(item: o, client: session.client) { Task { await session.retry(o.id) } }
case .report(_, let byline, let report, let compact):
VStack(alignment: .leading, spacing: 8) {
Byline(byline: byline)
@@ -104,11 +104,12 @@ public struct ConversationScreen: View {
/// A message this device is still sending, and how it is going.
struct OutgoingMessage: View {
let item: EquipoSession.Outgoing
+ var client: EquipoClient? = nil
var retry: () -> Void
var body: some View {
VStack(alignment: .trailing, spacing: 4) {
if let project = item.projectName { ProjectChip(name: project) }
- OwnMessage(text: item.text).opacity(item.state == .sending ? 0.7 : 1)
+ OwnMessage(text: item.text, attachments: item.attachments, client: client).opacity(item.state == .sending ? 0.7 : 1)
if let notice = item.notice { Text(notice).font(Typo.secondary).foregroundStyle(Palette.negative) }
switch item.state {
case .sending: Text(String(localized: "message.sending", bundle: .module)).font(Typo.caption).foregroundStyle(Palette.faint)
@@ -127,13 +128,19 @@ struct OutgoingMessage: View {
/// The composer: a pill with a send button centred in it.
struct Composer: View {
let placeholder: String
+ var attachments: AttachmentDraft? = nil
var onSend: (String) -> Void
@State private var text = ""
@FocusState private var focused: Bool
var body: some View {
- let has = !text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
+ let has = attachments?.canSend(text: text) ?? !text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
let shape = RoundedRectangle(cornerRadius: 22, style: .continuous)
- HStack(alignment: .bottom, spacing: 0) {
+ VStack(spacing: 4) {
+ if let attachments { AttachmentDraftStrip(draft: attachments) }
+ HStack(alignment: .bottom, spacing: 0) {
+ #if os(iOS)
+ if let attachments { PhoneAttachmentPicker(draft: attachments) }
+ #endif
TextField("", text: $text, prompt: Text(placeholder).foregroundColor(Palette.placeholder), axis: .vertical)
.font(Typo.body).foregroundStyle(Palette.controlText).textFieldStyle(.plain)
.lineLimit(1...6).focused($focused)
@@ -152,13 +159,14 @@ struct Composer: View {
}
.background(Palette.surface, in: shape)
.overlay(shape.strokeBorder(focused ? Palette.accent : Palette.controlBorder, lineWidth: 1))
+ }
.padding(.horizontal, 16).padding(.top, 10).padding(.bottom, 8)
.frame(maxWidth: 760).frame(maxWidth: .infinity)
.background(.bar)
}
private func send() {
let value = text.trimmingCharacters(in: .whitespacesAndNewlines)
- guard !value.isEmpty else { return }
+ guard attachments?.canSend(text: value) ?? !value.isEmpty else { return }
onSend(value); text = ""
}
}
diff --git a/native/apple/Sources/EquipoKit/UI/Screens/PhoneRoot.swift b/native/apple/Sources/EquipoKit/UI/Screens/PhoneRoot.swift
index 849710e5..86bf0d9d 100644
--- a/native/apple/Sources/EquipoKit/UI/Screens/PhoneRoot.swift
+++ b/native/apple/Sources/EquipoKit/UI/Screens/PhoneRoot.swift
@@ -9,6 +9,18 @@ public struct PhoneRoot: View {
public init(model: EquipoAppModel = EquipoAppModel()) { _model = State(initialValue: model) }
public var body: some View {
+ Group {
+ #if DEBUG
+ if ProcessInfo.processInfo.environment["EQUIPO_ATTACHMENTS_FIXTURE"] != nil { AttachmentsFixture() }
+ else { signedInContent }
+ #else
+ signedInContent
+ #endif
+ }
+ .tint(Palette.accent)
+ }
+
+ @ViewBuilder private var signedInContent: some View {
Group {
if let session = model.session, session.status != .signedOut {
PhoneTabs(model: model, session: session)
diff --git a/native/apple/Sources/EquipoMac/AttachmentPromises.swift b/native/apple/Sources/EquipoMac/AttachmentPromises.swift
new file mode 100644
index 00000000..058a64f7
--- /dev/null
+++ b/native/apple/Sources/EquipoMac/AttachmentPromises.swift
@@ -0,0 +1,41 @@
+import AppKit
+import EquipoKit
+
+/// Each accepted drop owns a private directory for the lifetime of its readers.
+/// Read inside NSFilePromiseReceiver's coordinated callback, then hand bytes to
+/// the draft so retry does not depend on the temporary file remaining on disk.
+private final class PromiseDirectory: @unchecked Sendable {
+ let url: URL
+ init() throws {
+ url = FileManager.default.temporaryDirectory.appendingPathComponent("equipo-drop-" + UUID().uuidString, isDirectory: true)
+ try FileManager.default.createDirectory(at: url, withIntermediateDirectories: false, attributes: [.posixPermissions: 0o700])
+ }
+ deinit { try? FileManager.default.removeItem(at: url) }
+}
+
+extension MacComposer {
+ func receive(_ promises: [NSFilePromiseReceiver], into draft: AttachmentDraft) {
+ do {
+ let directory = try PromiseDirectory()
+ let queue = OperationQueue(); queue.maxConcurrentOperationCount = 1
+ for promise in promises {
+ promise.receivePromisedFiles(atDestination: directory.url, options: [:], operationQueue: queue) { [directory] url, error in
+ let result = Result<Data, Error> {
+ if let error { throw error }
+ guard url.isFileURL,
+ url.standardizedFileURL.deletingLastPathComponent() == directory.url.standardizedFileURL,
+ (try url.resourceValues(forKeys: [.isRegularFileKey])).isRegularFile == true else { throw AttachmentFailure.type }
+ return try AttachmentFile.read(url)
+ }
+ if url.standardizedFileURL.deletingLastPathComponent() == directory.url.standardizedFileURL { try? FileManager.default.removeItem(at: url) }
+ Task { @MainActor in
+ switch result {
+ case .success(let data): await draft.add(data: data, name: url.lastPathComponent)
+ case .failure: draft.refuseFile()
+ }
+ }
+ }
+ }
+ } catch { draft.refuseFile() }
+ }
+}
diff --git a/native/apple/Sources/EquipoMac/EquipoMacApp.swift b/native/apple/Sources/EquipoMac/EquipoMacApp.swift
index 1b8cb729..9fd262c9 100644
--- a/native/apple/Sources/EquipoMac/EquipoMacApp.swift
+++ b/native/apple/Sources/EquipoMac/EquipoMacApp.swift
@@ -19,7 +19,7 @@ import SwiftUI
#if DEBUG
// Offline fixture captures must run this build, without an updater
// replacing it with a published app during the capture.
- if ProcessInfo.processInfo.environment["EQUIPO_STOPPED_FIXTURE"] != nil { return nil }
+ if ProcessInfo.processInfo.environment["EQUIPO_STOPPED_FIXTURE"] != nil || ProcessInfo.processInfo.environment["EQUIPO_ATTACHMENTS_FIXTURE"] != nil { return nil }
#endif
return NativeUpdater(policy: .quiet)
}()
@@ -31,6 +31,7 @@ import SwiftUI
#if DEBUG
if ProcessInfo.processInfo.environment["EQUIPO_STOPPED_FIXTURE"]?.hasPrefix("conversation-") == true { StoppedConversationFixture() }
else if ProcessInfo.processInfo.environment["EQUIPO_STOPPED_FIXTURE"] != nil { StoppedWorkFixture() }
+ else if ProcessInfo.processInfo.environment["EQUIPO_ATTACHMENTS_FIXTURE"] != nil { MacAttachmentsFixture() }
else { MacRoot(model: model) }
#else
MacRoot(model: model)
diff --git a/native/apple/Sources/EquipoMac/LiveTranscript.swift b/native/apple/Sources/EquipoMac/LiveTranscript.swift
index c28db873..633c7295 100644
--- a/native/apple/Sources/EquipoMac/LiveTranscript.swift
+++ b/native/apple/Sources/EquipoMac/LiveTranscript.swift
@@ -70,6 +70,7 @@ final class LiveTranscript: NSView {
addSubview(scroll)
addSubview(composer)
addSubview(selectionHost)
+ composer.attach(session.attachments)
composer.onHeightChange = { [weak self] in self?.needsLayout = true }
composer.onSend = { [weak self] text in
guard let self else { return }
@@ -200,11 +201,12 @@ final class LiveTranscript: NSView {
}
switch item {
case .own(let message):
- place(ownBubble(message.text, width: width), x: width - ownWidth(message.text, width: width))
+ let bubble = ownBubble(message.text, attachments: message.attachments ?? [], width: width)
+ place(bubble, x: width - bubble.frame.width)
case .coordinator, .draft, .notice: break
case .outgoing(let outgoing):
if let project = outgoing.projectName { place(makeText(project, MacType.caption, .webSecondary, width: width), gapAfter: 4) }
- let bubble = ownBubble(outgoing.text, width: width)
+ let bubble = ownBubble(outgoing.text, attachments: outgoing.attachments, width: width)
bubble.alphaValue = outgoing.state == .sending ? 0.6 : 1
place(bubble, x: width - bubble.frame.width, gapAfter: 4)
if let notice = outgoing.notice {
@@ -259,7 +261,16 @@ final class LiveTranscript: NSView {
private func ownWidth(_ text: String, width: CGFloat) -> CGFloat {
makeText(text, MacType.line, .webText, width: min(width * 0.7, 520) - 28, lineSpacing: 2).frame.width + 28
}
- private func ownBubble(_ value: String, width: CGFloat) -> NSView {
+ private func ownBubble(_ value: String, attachments: [MessageAttachment] = [], width: CGFloat) -> NSView {
+ if !attachments.isEmpty {
+ let host = NSHostingView(rootView: VStack(alignment: .leading, spacing: 8) {
+ MessageAttachments(attachments, client: session.client)
+ if !value.isEmpty { Text(value).textSelection(.enabled) }
+ }.padding(14).frame(width: min(width * 0.8, 520))
+ .background(Color(nsColor: .webSoft), in: .rect(cornerRadius: 16)))
+ host.frame.size = NSSize(width: min(width * 0.8, 520), height: ceil(host.fittingSize.height))
+ return host
+ }
let label = makeText(value, MacType.line, .webText, width: min(width * 0.7, 520) - 28, lineSpacing: 2, selectable: true)
let card = PaintView(frame: NSRect(x: 0, y: 0, width: label.frame.width + 28, height: label.frame.height + 20)) { r in
let p = NSBezierPath(roundedRect: r.insetBy(dx: 0.5, dy: 0.5), xRadius: 16, yRadius: 16)
diff --git a/native/apple/Sources/EquipoMac/MacAttachmentsFixture.swift b/native/apple/Sources/EquipoMac/MacAttachmentsFixture.swift
new file mode 100644
index 00000000..e21ad59e
--- /dev/null
+++ b/native/apple/Sources/EquipoMac/MacAttachmentsFixture.swift
@@ -0,0 +1,61 @@
+#if DEBUG
+import AppKit
+import SwiftUI
+import EquipoKit
+
+struct MacAttachmentsFixture: NSViewRepresentable {
+ func makeNSView(context: Context) -> LiveTranscript {
+ let session = AttachmentsFixture.makeSession()
+ let view = LiveTranscript(session: session, openTask: { _ in })
+ Task { @MainActor [weak view] in
+ await session.refresh()
+ guard let view else { return }
+ view.update(items: Feed.build(session))
+ view.composer.setText("Home’s sign-in button is cut off on my phone.")
+ // Exercise the complete destination lifecycle with synthetic drag info.
+ let board = NSPasteboard.withUniqueName()
+ board.setData(AttachmentsFixture.image, forType: .png)
+ let drag = FixtureAttachmentDrag(board)
+ if view.composer.editor.draggingEntered(drag) == .copy,
+ view.composer.editor.draggingUpdated(drag) == .copy,
+ view.composer.editor.prepareForDragOperation(drag) {
+ _ = view.composer.editor.performDragOperation(drag)
+ }
+ board.releaseGlobally()
+ try? await Task.sleep(for: .seconds(2))
+ guard let path = ProcessInfo.processInfo.environment["EQUIPO_FIXTURE_CAPTURE"],
+ let window = view.window, let content = window.contentView else { return }
+ window.appearance = NSAppearance(named: .aqua)
+ try? await Task.sleep(for: .milliseconds(200))
+ window.setContentSize(NSSize(width: 1000, height: 760))
+ content.layoutSubtreeIfNeeded(); window.displayIfNeeded()
+ if let bitmap = content.bitmapImageRepForCachingDisplay(in: content.bounds) {
+ content.cacheDisplay(in: content.bounds, to: bitmap)
+ _ = FileManager.default.createFile(atPath: path, contents: bitmap.representation(using: .png, properties: [:]))
+ }
+ }
+ return view
+ }
+ func updateNSView(_ view: LiveTranscript, context: Context) {}
+}
+
+@MainActor final class FixtureAttachmentDrag: NSObject, NSDraggingInfo {
+ let draggingPasteboard: NSPasteboard
+ init(_ board: NSPasteboard) { draggingPasteboard = board }
+ var draggingDestinationWindow: NSWindow? { nil }
+ var draggingSourceOperationMask: NSDragOperation { .copy }
+ var draggingLocation: NSPoint { .zero }
+ var draggedImageLocation: NSPoint { .zero }
+ nonisolated var draggedImage: NSImage? { nil }
+ var draggingSource: Any? { nil }
+ var draggingSequenceNumber: Int { 1 }
+ var draggingFormation: NSDraggingFormation = .none
+ var animatesToDestination = false
+ var numberOfValidItemsForDrop = 1
+ var springLoadingHighlight: NSSpringLoadingHighlight { .none }
+ func slideDraggedImage(to screenPoint: NSPoint) {}
+ nonisolated override func namesOfPromisedFilesDropped(atDestination dropDestination: URL) -> [String]? { nil }
+ func resetSpringLoading() {}
+ func enumerateDraggingItems(options: NSDraggingItemEnumerationOptions = [], for view: NSView?, classes classArray: [AnyClass], searchOptions: [NSPasteboard.ReadingOptionKey: Any] = [:], using block: (NSDraggingItem, Int, UnsafeMutablePointer<ObjCBool>) -> Void) {}
+}
+#endif
diff --git a/native/apple/Sources/EquipoMac/MacComposer.swift b/native/apple/Sources/EquipoMac/MacComposer.swift
index 7ff677ee..e707bb5a 100644
--- a/native/apple/Sources/EquipoMac/MacComposer.swift
+++ b/native/apple/Sources/EquipoMac/MacComposer.swift
@@ -1,11 +1,33 @@
import AppKit
import EquipoKit
+import SwiftUI
+import Observation
/// The composer's text view: Return sends, Shift-Return starts a new line,
/// and an input method's marked text is never sent half typed.
final class ComposerEditor: NSTextView {
var onSubmit: (() -> Void)?
var placeholder = ""
+ var onAttachments: ((NSPasteboard) -> Bool)?
+ override func paste(_ sender: Any?) {
+ if onAttachments?(NSPasteboard.general) != true { super.paste(sender) }
+ }
+ private func accepts(_ board: NSPasteboard) -> Bool {
+ board.availableType(from: [.fileURL, .png, .tiff] + NSFilePromiseReceiver.readableDraggedTypes.map { NSPasteboard.PasteboardType($0) }) != nil
+ }
+ override func draggingEntered(_ sender: any NSDraggingInfo) -> NSDragOperation {
+ return accepts(sender.draggingPasteboard) ? .copy : super.draggingEntered(sender)
+ }
+ override func draggingUpdated(_ sender: any NSDraggingInfo) -> NSDragOperation {
+ return accepts(sender.draggingPasteboard) ? .copy : super.draggingUpdated(sender)
+ }
+ override func prepareForDragOperation(_ sender: any NSDraggingInfo) -> Bool {
+ return accepts(sender.draggingPasteboard) || super.prepareForDragOperation(sender)
+ }
+ override func performDragOperation(_ sender: any NSDraggingInfo) -> Bool {
+ guard accepts(sender.draggingPasteboard) else { return super.performDragOperation(sender) }
+ return onAttachments?(sender.draggingPasteboard) == true
+ }
override func draw(_ dirtyRect: NSRect) {
super.draw(dirtyRect)
if string.isEmpty {
@@ -33,7 +55,7 @@ final class ComposerPill: NSView {
}
}
-/// The conversation's composer, text only in slice 1: a pill that grows to
+/// The conversation's composer: attachments above a pill that grows to
/// six lines, then scrolls, with a 44-point send target centred on its last
/// line.
final class MacComposer: NSView, NSTextViewDelegate {
@@ -46,6 +68,52 @@ final class MacComposer: NSView, NSTextViewDelegate {
var onHeightChange: (() -> Void)?
private(set) var desiredHeight: CGFloat = 44
private var updating = false
+ private var draft: AttachmentDraft?
+ private var attachmentHost: NSHostingView<AnyView>?
+ private var attachmentHeight: CGFloat = 0
+
+ func attach(_ draft: AttachmentDraft) {
+ self.draft = draft
+ let host = NSHostingView(rootView: AnyView(AttachmentDraftStrip(draft: draft).fixedSize(horizontal: false, vertical: true)
+ .onGeometryChange(for: CGFloat.self) { $0.size.height } action: { [weak self] height in
+ Task { @MainActor in
+ guard let self, self.attachmentHeight != height else { return }
+ self.attachmentHeight = height; self.refresh()
+ }
+ }))
+ attachmentHost = host; addSubview(host)
+ editor.registerForDraggedTypes([.fileURL, .png, .tiff] + NSFilePromiseReceiver.readableDraggedTypes.map { NSPasteboard.PasteboardType($0) })
+ editor.onAttachments = { [weak self] pasteboard in self?.acceptAttachments(pasteboard) ?? false }
+ observeDraft()
+ }
+
+ @discardableResult func acceptAttachments(_ pasteboard: NSPasteboard) -> Bool {
+ guard let draft else { return false }
+ if let promises = pasteboard.readObjects(forClasses: [NSFilePromiseReceiver.self]) as? [NSFilePromiseReceiver], !promises.isEmpty {
+ receive(promises, into: draft)
+ return true
+ }
+ if let urls = pasteboard.readObjects(forClasses: [NSURL.self], options: [.urlReadingFileURLsOnly: true]) as? [URL], !urls.isEmpty {
+ for url in urls { Task { await draft.add(url: url) } }
+ return true
+ }
+ for type in [NSPasteboard.PasteboardType.png, .tiff] {
+ if let data = pasteboard.data(forType: type) {
+ Task { await draft.add(data: data, name: type == .png ? "image.png" : "image.tiff") }
+ return true
+ }
+ }
+ return false
+ }
+
+ private func observeDraft() {
+ withObservationTracking {
+ _ = draft?.items; _ = draft?.notice
+ } onChange: { [weak self] in
+ Task { @MainActor in self?.refresh(); self?.observeDraft() }
+ }
+ refresh()
+ }
init() {
super.init(frame: .zero)
@@ -81,7 +149,7 @@ final class MacComposer: NSView, NSTextViewDelegate {
required init?(coder: NSCoder) { fatalError() }
var text: String { editor.string }
- private var canSend: Bool { !editor.string.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty }
+ private var canSend: Bool { draft?.canSend(text: editor.string) ?? !editor.string.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty }
func textDidChange(_ notification: Notification) { refresh() }
func textDidBeginEditing(_ notification: Notification) { pill.needsDisplay = true }
@@ -91,7 +159,7 @@ final class MacComposer: NSView, NSTextViewDelegate {
func submit() {
let value = editor.string.trimmingCharacters(in: .whitespacesAndNewlines)
- guard !value.isEmpty else { return }
+ guard canSend else { return }
editor.string = ""; editor.needsDisplay = true
refresh(); onSend?(value)
window?.makeFirstResponder(editor)
@@ -115,13 +183,15 @@ final class MacComposer: NSView, NSTextViewDelegate {
let used = editor.layoutManager?.usedRect(for: editor.textContainer!).height ?? 24
let contentHeight = max(24, ceil(used))
let height = min(164, contentHeight + 20)
- pill.frame = NSRect(x: 0, y: 0, width: pillWidth, height: height)
+ attachmentHost?.frame = NSRect(x: 0, y: 0, width: pillWidth, height: attachmentHeight)
+ let attachmentSpace = attachmentHeight > 0 ? attachmentHeight + 8 : 0
+ pill.frame = NSRect(x: 0, y: attachmentSpace, width: pillWidth, height: height)
textScroll.frame = NSRect(x: 0, y: 10, width: editorWidth, height: height - 20)
editor.frame.size = NSSize(width: editorWidth, height: contentHeight)
textScroll.hasVerticalScroller = contentHeight > 144
send.frame = NSRect(x: pillWidth - 44, y: height - 44, width: 44, height: 44)
- let changed = desiredHeight != height
- desiredHeight = height
+ let changed = desiredHeight != height + attachmentSpace
+ desiredHeight = height + attachmentSpace
updating = false
if changed { onHeightChange?() }
}
diff --git a/native/apple/Tests/EquipoKitTests/AttachmentFollowupTests.swift b/native/apple/Tests/EquipoKitTests/AttachmentFollowupTests.swift
new file mode 100644
index 00000000..0db8d17e
--- /dev/null
+++ b/native/apple/Tests/EquipoKitTests/AttachmentFollowupTests.swift
@@ -0,0 +1,114 @@
+import Foundation
+import ImageIO
+import Synchronization
+import Testing
+import UniformTypeIdentifiers
+@testable import EquipoKit
+
+private final class ScopedFileFixture: AttachmentFileAccess, Sendable {
+ struct State { var active = false; var events: [String] = [] }
+ let state = Mutex(State())
+ let regular: Bool
+ init(regular: Bool) { self.regular = regular }
+ func start(_ url: URL) -> Bool { state.withLock { $0.active = true; $0.events.append("start") }; return true }
+ func stop(_ url: URL) { state.withLock { $0.active = false; $0.events.append("stop") } }
+ func isRegularFile(_ url: URL) throws -> Bool {
+ try state.withLock {
+ $0.events.append("metadata")
+ guard $0.active else { throw CocoaError(.fileReadNoPermission) }
+ return regular
+ }
+ }
+}
+
+@Suite struct AttachmentFollowupTests {
+ @MainActor @Test(arguments: [true, false])
+ func scopedMetadataIsReadOnlyDuringAccess(_ regular: Bool) async throws {
+ let server = AttachmentServer(), access = ScopedFileFixture(regular: regular)
+ let draft = AttachmentDraft(client: EquipoClient(transport: server, token: "fixture"))
+ draft.fileAccess = access
+ let url = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString + ".txt")
+ try Data("a selected file".utf8).write(to: url)
+ defer { try? FileManager.default.removeItem(at: url) }
+ await draft.add(url: url)
+ #expect(access.state.withLock { $0.events } == ["start", "metadata", "stop"])
+ #expect(!access.state.withLock { $0.active })
+ if regular {
+ #expect(draft.readyAttachments.count == 1)
+ } else {
+ #expect(draft.items.isEmpty)
+ #expect(draft.notice == AttachmentFailure.type.words)
+ #expect(await server.requests.isEmpty)
+ }
+ }
+
+ @Test func unchangedImagesStillHaveTheUploadByteLimit() throws {
+ var data = try AttachmentTests.image()
+ data.append(Data(repeating: 0, count: AttachmentLimits.maxBytes + 1 - data.count))
+ #expect(CGImageSourceCreateWithData(data as CFData, nil) != nil)
+ #expect(throws: AttachmentFailure.tooLarge) { try AttachmentFile.prepare(data, name: "screen.png") }
+ }
+
+ @Test func transparentPixelsBecomeWhiteWhenConvertedToJPEG() throws {
+ let canvas = try #require(CGContext(data: nil, width: 3000, height: 2, bitsPerComponent: 8, bytesPerRow: 0, space: CGColorSpaceCreateDeviceRGB(), bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue))
+ canvas.clear(CGRect(x: 0, y: 0, width: 3000, height: 2))
+ let bytes = NSMutableData()
+ let destination = try #require(CGImageDestinationCreateWithData(bytes, UTType.png.identifier as CFString, 1, nil))
+ CGImageDestinationAddImage(destination, try #require(canvas.makeImage()), nil)
+ #expect(CGImageDestinationFinalize(destination))
+ let file = try AttachmentFile.prepare(bytes as Data, name: "transparent.png")
+ #expect(file.mediaType == "image/jpeg")
+ let source = try #require(CGImageSourceCreateWithData(file.data as CFData, nil))
+ let image = try #require(CGImageSourceCreateImageAtIndex(source, 0, nil))
+ let pixel = try #require(CGContext(data: nil, width: 1, height: 1, bitsPerComponent: 8, bytesPerRow: 4, space: CGColorSpaceCreateDeviceRGB(), bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue))
+ pixel.draw(image, in: CGRect(x: 0, y: 0, width: 1, height: 1))
+ let values = try #require(pixel.data).assumingMemoryBound(to: UInt8.self)
+ #expect(values[0] > 245 && values[1] > 245 && values[2] > 245)
+ }
+
+ @MainActor @Test func clearCancelsEveryInFlightUpload() async throws {
+ let server = ClearAttachmentServer()
+ let draft = AttachmentDraft(client: EquipoClient(transport: server, token: "fixture"))
+ let tasks = (0..<2).map { _ in Task { await draft.add(data: Data("note".utf8), name: "note.txt") } }
+ for _ in 0..<100 { if await server.started == 2 { break }; try await Task.sleep(for: .milliseconds(10)) }
+ #expect(await server.started == 2)
+ draft.clear()
+ for _ in 0..<100 { if await server.cancelled == 2 { break }; try await Task.sleep(for: .milliseconds(10)) }
+ #expect(await server.cancelled == 2)
+ #expect(draft.items.isEmpty)
+ for task in tasks { task.cancel(); await task.value }
+ }
+
+ @MainActor @Test func cancellationDuringPreparingDoesNotStartAnUpload() async throws {
+ let server = AttachmentServer(), loader = PreparingAttachment()
+ let draft = AttachmentDraft(client: EquipoClient(transport: server, token: "fixture"))
+ let adding = Task { await draft.add(name: "note.txt") { await loader.load() } }
+ for _ in 0..<100 { if await loader.waiting { break }; try await Task.sleep(for: .milliseconds(10)) }
+ #expect(await loader.waiting)
+ // Cancel the caller without removing the item: its identity still matches.
+ adding.cancel()
+ await loader.finish()
+ await adding.value
+ #expect(await server.requests.isEmpty)
+ #expect(draft.readyAttachments.isEmpty)
+ }
+}
+
+private actor PreparingAttachment {
+ var pending: CheckedContinuation<Data, Never>?
+ var waiting: Bool { pending != nil }
+ func load() async -> Data { await withCheckedContinuation { pending = $0 } }
+ func finish() { pending?.resume(returning: Data("note".utf8)); pending = nil }
+}
+
+private actor ClearAttachmentServer: EquipoTransport {
+ nonisolated let origin = URL(string: "https://clear.invalid")!
+ var started = 0
+ var cancelled = 0
+ func send(_ request: APIRequest) async throws -> APIResponse {
+ started += 1
+ do { try await Task.sleep(for: .seconds(30)) } catch { cancelled += 1; throw error }
+ return APIResponse(status: 201, data: Data(AttachmentServer.attachment.utf8))
+ }
+ func lines(_ request: APIRequest) async throws -> AsyncThrowingStream<String, Error> { AsyncThrowingStream { $0.finish() } }
+}
diff --git a/native/apple/Tests/EquipoKitTests/AttachmentHTTPTests.swift b/native/apple/Tests/EquipoKitTests/AttachmentHTTPTests.swift
new file mode 100644
index 00000000..2393729e
--- /dev/null
+++ b/native/apple/Tests/EquipoKitTests/AttachmentHTTPTests.swift
@@ -0,0 +1,83 @@
+#if os(macOS)
+import Foundation
+import Synchronization
+import Testing
+@testable import EquipoKit
+
+/// A loopback fake server exercises URLSession's raw upload and progress
+/// delegate, then resolves message attachment ids to the coordinator's bytes.
+@Suite struct AttachmentHTTPTests {
+ @Test func imageReachesCoordinatorOverHTTP() async throws {
+ let process = Process(), output = Pipe()
+ process.executableURL = URL(fileURLWithPath: "/usr/bin/python3")
+ process.standardOutput = output
+ let sent: Sent = try Fixture.decode("thin/sent")
+ let encoder = EquipoJSON.encoder; encoder.dateEncodingStrategy = .iso8601
+ process.arguments = ["-u", "-c", Self.server,
+ AttachmentServer.attachment,
+ String(decoding: try encoder.encode(sent), as: UTF8.self)]
+ try process.run()
+ defer { process.terminate(); process.waitUntilExit() }
+ var port = Data()
+ while let byte = try output.fileHandleForReading.read(upToCount: 1), !byte.isEmpty {
+ if byte == Data([10]) { break }; port.append(byte)
+ }
+ let origin = try #require(URL(string: "http://127.0.0.1:" + String(decoding: port, as: UTF8.self)))
+ let client = EquipoClient(transport: URLSessionTransport(origin: origin, observe: { _ in }), token: "fixture-http")
+ let file = try AttachmentFile.prepare(AttachmentTests.image(width: 512, height: 512), name: "screen.png")
+ let progress = Mutex<[Double]>([])
+ let attachment = try await client.upload(file) { value in progress.withLock { $0.append(value) } }
+ let response = try await client.send(EquipoClient.message("", attachments: [attachment.id]))
+ #expect(response.message.attachments?.first?.id == attachment.id)
+ #expect(try await client.attachmentData(attachment.id) == file.data)
+ var capped = APIRequest("GET", "/attachments/" + attachment.id, bearer: "fixture-http")
+ capped.maximumResponseBytes = 1
+ await #expect(throws: EquipoAPIError.tooLarge) { try await URLSessionTransport(origin: origin, observe: { _ in }).send(capped) }
+ var redirect = APIRequest("POST", "/redirect", body: file.data, bearer: "fixture-http")
+ redirect.uploadProgress = UploadProgress { _ in }
+ let refused = try await URLSessionTransport(origin: origin, observe: { _ in }).send(redirect)
+ #expect(refused.status == 307)
+ #expect(progress.withLock { $0.contains { $0 > 0 && $0 <= 1 } })
+ }
+
+ static let server = #"""
+import http.server,json,sys
+attachment=json.loads(sys.argv[1]); sent=json.loads(sys.argv[2])
+uploaded=b''; delivered=b''
+class Handler(http.server.BaseHTTPRequestHandler):
+ def log_message(self,*args): pass
+ def answer(self,status,data,kind='application/json'):
+ self.send_response(status); self.send_header('Content-Type',kind)
+ self.send_header('Content-Length',str(len(data))); self.end_headers(); self.wfile.write(data)
+ def do_POST(self):
+ global uploaded,delivered
+ body=self.rfile.read(int(self.headers.get('Content-Length','0')))
+ if self.headers.get('Authorization')!='Bearer fixture-http' or self.headers.get('Cookie'):
+ return self.answer(403,b'{}')
+ if self.path=='/api/v1/redirect':
+ self.send_response(307); self.send_header('Location','/api/v1/attachments'); self.send_header('Content-Length','0'); self.end_headers(); return
+ if self.path=='/api/v1/attachments':
+ if self.headers.get('Content-Type')!='image/png' or not body.startswith(bytes([137])+b'PNG'):
+ return self.answer(415,b'{}')
+ uploaded=body
+ return self.answer(201,json.dumps(attachment).encode())
+ if self.path=='/api/v1/messages':
+ message=json.loads(body)
+ if message.get('attachments')!=[attachment['id']] or not uploaded:
+ return self.answer(422,b'{}')
+ delivered=uploaded
+ sent['message']['attachments']=[attachment]
+ return self.answer(201,json.dumps(sent).encode())
+ self.answer(404,b'{}')
+ def do_GET(self):
+ if self.headers.get('Authorization')!='Bearer fixture-http':
+ return self.answer(403,b'{}')
+ if self.path=='/api/v1/attachments/'+attachment['id']:
+ return self.answer(200,delivered,'image/png')
+ self.answer(404,b'{}')
+server=http.server.HTTPServer(('127.0.0.1',0),Handler)
+print(server.server_address[1],flush=True)
+server.serve_forever()
+"""#
+}
+#endif
diff --git a/native/apple/Tests/EquipoKitTests/AttachmentReviewTests.swift b/native/apple/Tests/EquipoKitTests/AttachmentReviewTests.swift
new file mode 100644
index 00000000..0941ee3e
--- /dev/null
+++ b/native/apple/Tests/EquipoKitTests/AttachmentReviewTests.swift
@@ -0,0 +1,188 @@
+import Foundation
+import ImageIO
+import Testing
+import UniformTypeIdentifiers
+@testable import EquipoKit
+
+@Suite struct AttachmentReviewTests {
+ @Test func largeHEICAndWebPMatchWebSizing() throws {
+ let heic = try AttachmentTests.image(.heic, width: 8064, height: 6048)
+ let url = try #require(Bundle.module.url(forResource: "large", withExtension: "webp", subdirectory: "Fixtures/attachments"))
+ for (bytes, name, height) in [(heic, "photo.heic", 1920), (try Data(contentsOf: url), "large.webp", 1280)] {
+ let file = try AttachmentFile.prepare(bytes, name: name)
+ #expect(file.mediaType == "image/jpeg")
+ #expect(file.width == 2560 && file.height == height)
+ #expect(file.data.count <= AttachmentLimits.maxBytes)
+ }
+ }
+
+ @Test func conversionStripsMetadataAndAppliesOrientation() throws {
+ let source = try #require(CGImageSourceCreateWithData(AttachmentTests.image() as CFData, nil))
+ let image = try #require(CGImageSourceCreateImageAtIndex(source, 0, nil))
+ let bytes = NSMutableData()
+ let dest = try #require(CGImageDestinationCreateWithData(bytes, UTType.heic.identifier as CFString, 1, nil))
+ let metadata: [CFString: Any] = [kCGImagePropertyOrientation: 6,
+ kCGImagePropertyGPSDictionary: [kCGImagePropertyGPSLatitude: 53.3, kCGImagePropertyGPSLatitudeRef: "N", kCGImagePropertyGPSLongitude: 6.2, kCGImagePropertyGPSLongitudeRef: "W"],
+ kCGImagePropertyExifDictionary: [kCGImagePropertyExifUserComment: "private fixture metadata"]]
+ CGImageDestinationAddImage(dest, image, metadata as CFDictionary)
+ #expect(CGImageDestinationFinalize(dest))
+ let file = try AttachmentFile.prepare(bytes as Data, name: "private.heic")
+ #expect(file.width == 8 && file.height == 12)
+ let converted = try #require(CGImageSourceCreateWithData(file.data as CFData, nil))
+ let properties = try #require(CGImageSourceCopyPropertiesAtIndex(converted, 0, nil) as? [CFString: Any])
+ #expect(properties[kCGImagePropertyGPSDictionary] == nil)
+ #expect((properties[kCGImagePropertyExifDictionary] as? [CFString: Any])?[kCGImagePropertyExifUserComment] == nil)
+ }
+
+ @Test func convertedBytesAreCheckedAgain() throws {
+ let input = try AttachmentTests.image(.heic)
+ #expect(throws: AttachmentFailure.tooLarge) { try AttachmentFile.prepare(input, name: "photo.heic", maximumBytes: 1) }
+ }
+
+ @Test func emptyAndBoundedFileReads() throws {
+ #expect(throws: AttachmentFailure.type) { try AttachmentFile.prepare(Data(), name: "empty.txt") }
+ let url = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)
+ defer { try? FileManager.default.removeItem(at: url) }
+ FileManager.default.createFile(atPath: url.path, contents: nil)
+ let handle = try FileHandle(forWritingTo: url)
+ try handle.truncate(atOffset: 128 * 1024 * 1024 + 1); try handle.close()
+ #expect(throws: AttachmentFailure.tooLarge) { try AttachmentFile.read(url) }
+ }
+}
+
+actor AttachmentReviewServer: EquipoTransport {
+ nonisolated let origin = URL(string: "https://review.invalid")!
+ var requests: [APIRequest] = []
+ var callbacks: [UploadProgress] = []
+ var code: String?
+ var hold = false
+ var lostProject = false
+ var cancelled = false
+ var pending: [CheckedContinuation<APIResponse, Error>] = []
+ func configure(code: String? = nil, hold: Bool = false, lostProject: Bool = false) { self.code = code; self.hold = hold; self.lostProject = lostProject }
+ func send(_ request: APIRequest) async throws -> APIResponse {
+ requests.append(request)
+ if request.path == "/attachments" {
+ if let callback = request.uploadProgress { callbacks.append(callback) }
+ if let code { self.code = nil; return APIResponse(status: 422, data: Data("{\"code\":\"\(code)\",\"copy_key\":\"api.\(code)\",\"request_id\":\"fixture\"}".utf8)) }
+ if hold { return try await withCheckedThrowingContinuation { pending.append($0) } }
+ return APIResponse(status: 201, data: Data(AttachmentServer.attachment.utf8))
+ }
+ if request.path == "/messages" {
+ if lostProject { lostProject = false; return APIResponse(status: 404, data: Data("{\"code\":\"not_found\",\"copy_key\":\"api.not_found\",\"request_id\":\"fixture\"}".utf8)) }
+ let sent: Sent = try Fixture.decode("thin/sent")
+ let encoder = EquipoJSON.encoder; encoder.dateEncodingStrategy = .iso8601
+ return APIResponse(status: 201, data: try encoder.encode(sent))
+ }
+ return APIResponse(status: 200, data: Data("{}".utf8))
+ }
+ func emit(_ index: Int, _ value: Double) { callbacks[index].report(value) }
+ func finish() { for c in pending { c.resume(returning: APIResponse(status: 201, data: Data(AttachmentServer.attachment.utf8))) }; pending = [] }
+ func lines(_ request: APIRequest) async throws -> AsyncThrowingStream<String, Error> { AsyncThrowingStream { $0.finish() } }
+}
+
+extension AttachmentReviewTests {
+ @MainActor @Test func failedDraftCannotSendAndThreadsRejectAttachments() async throws {
+ let server = AttachmentReviewServer(); await server.configure(code: "attachment_type")
+ let session = EquipoSession(account: .new(origin: server.origin, label: "Fixture"), accounts: DeviceAccounts(store: MemorySecretStore()), transport: server)
+ await session.attachments.add(data: try AttachmentTests.image(), name: "screen.png")
+ await session.sendFromComposer("note").value
+ #expect(await server.requests.filter { $0.path == "/messages" }.isEmpty)
+ #expect(session.attachments.items.count == 1)
+ let attachment = try EquipoJSON.decoder.decode(MessageAttachment.self, from: Data(AttachmentServer.attachment.utf8))
+ await session.send("note", inThreadOf: "task", attachments: [attachment])
+ #expect(await server.requests.filter { $0.path.contains("/thread") }.isEmpty)
+ }
+
+ @MainActor @Test func lostProjectRetryKeepsAttachmentIDs() async throws {
+ let server = AttachmentReviewServer(); await server.configure(lostProject: true)
+ let session = EquipoSession(account: .new(origin: server.origin, label: "Fixture"), accounts: DeviceAccounts(store: MemorySecretStore()), transport: server)
+ let attachment = try EquipoJSON.decoder.decode(MessageAttachment.self, from: Data(AttachmentServer.attachment.utf8))
+ await session.send("note", projectID: "lost", attachments: [attachment])
+ let pending = try #require(session.outgoing.first)
+ #expect(pending.goneProject)
+ await session.retry(pending.id)
+ let requests = await server.requests.filter { $0.path == "/messages" }
+ #expect(requests.count == 2)
+ let bytes = try #require(requests.last?.body)
+ let body = try #require(try JSONSerialization.jsonObject(with: bytes) as? [String: Any])
+ #expect(body["attachments"] as? [String] == [attachment.id]); #expect(body["project_id"] == nil)
+ }
+
+ @MainActor @Test func retryIsSingleAndOldProgressCannotOverwriteNewOrReadyState() async throws {
+ let server = AttachmentReviewServer(); await server.configure(code: "attachment_type")
+ let draft = AttachmentDraft(client: EquipoClient(transport: server, token: "fixture"))
+ await draft.add(data: try AttachmentTests.image(), name: "screen.png")
+ let id = try #require(draft.items.first?.id)
+ await server.configure(hold: true)
+ let first = Task { await draft.retry(id) }
+ for _ in 0..<100 { if await server.callbacks.count >= 2 { break }; try await Task.sleep(for: .milliseconds(10)) }
+ let second = Task { await draft.retry(id) }
+ try await Task.sleep(for: .milliseconds(40))
+ #expect(await server.callbacks.count == 2)
+ await server.emit(0, 0.99)
+ try await Task.sleep(for: .milliseconds(30))
+ if case .uploading(let progress) = draft.items.first?.state { #expect(progress == 0) } else { Issue.record("Expected retry upload") }
+ await server.finish(); await first.value; await second.value
+ await server.emit(1, 0.2)
+ try await Task.sleep(for: .milliseconds(30))
+ #expect(draft.readyAttachments.count == 1)
+ }
+
+ @MainActor @Test(arguments: ["attachment_too_large", "attachment_pixels", "attachment_type", "attachment_heic", "attachment_limit"])
+ func serverCodesUseReviewedWords(_ code: String) async throws {
+ let server = AttachmentReviewServer(); await server.configure(code: code)
+ let draft = AttachmentDraft(client: EquipoClient(transport: server, token: "fixture"))
+ await draft.add(data: try AttachmentTests.image(), name: "screen.png")
+ #expect(draft.items.first?.failure == EquipoStrings.text(String.LocalizationValue("api." + code)))
+ }
+
+ @Test func readsCarryBearerAndRefuseOversizedResponses() async throws {
+ let server = AttachmentServer()
+ let client = EquipoClient(transport: server, token: "private-bearer")
+ _ = try await client.attachmentData("at_fixture")
+ _ = try await client.attachmentData("at_fixture", preview: true)
+ for request in await server.requests { #expect(request.bearer == "private-bearer"); #expect(request.maximumResponseBytes == AttachmentLimits.maxBytes) }
+ let huge = HugeAttachmentServer()
+ await #expect(throws: EquipoAPIError.tooLarge) { try await EquipoClient(transport: huge, token: "fixture").attachmentData("huge") }
+ }
+
+ @Test func uploadDelegateRefusesRedirects() async throws {
+ let delegate = UploadDelegate(UploadProgress { _ in })
+ let session = URLSession(configuration: .ephemeral)
+ defer { session.invalidateAndCancel() }
+ let target = URL(string: "https://other.invalid")!
+ let response = try #require(HTTPURLResponse(url: target, statusCode: 307, httpVersion: nil, headerFields: ["Location": target.absoluteString]))
+ let result = await delegate.urlSession(session, task: session.dataTask(with: target), willPerformHTTPRedirection: response, newRequest: URLRequest(url: target))
+ #expect(result == nil)
+ }
+
+ @MainActor @Test func removalCancelsTheActualUpload() async throws {
+ let server = CancellableAttachmentServer()
+ let draft = AttachmentDraft(client: EquipoClient(transport: server, token: "fixture"))
+ let adding = Task { await draft.add(data: try AttachmentTests.image(), name: "screen.png") }
+ for _ in 0..<100 { if await server.started { break }; try await Task.sleep(for: .milliseconds(10)) }
+ draft.remove(try #require(draft.items.first?.id))
+ for _ in 0..<100 { if await server.cancelled { break }; try await Task.sleep(for: .milliseconds(10)) }
+ #expect(await server.cancelled)
+ adding.cancel()
+ try await adding.value
+ }
+}
+
+private struct HugeAttachmentServer: EquipoTransport {
+ let origin = URL(string: "https://huge.invalid")!
+ func send(_ request: APIRequest) async throws -> APIResponse { APIResponse(status: 200, data: Data(repeating: 0, count: AttachmentLimits.maxBytes + 1)) }
+ func lines(_ request: APIRequest) async throws -> AsyncThrowingStream<String, Error> { AsyncThrowingStream { $0.finish() } }
+}
+private actor CancellableAttachmentServer: EquipoTransport {
+ nonisolated let origin = URL(string: "https://cancel.invalid")!
+ var started = false
+ var cancelled = false
+ func send(_ request: APIRequest) async throws -> APIResponse {
+ started = true
+ do { try await Task.sleep(for: .seconds(30)) } catch { cancelled = true; throw error }
+ return APIResponse(status: 201, data: Data(AttachmentServer.attachment.utf8))
+ }
+ func lines(_ request: APIRequest) async throws -> AsyncThrowingStream<String, Error> { AsyncThrowingStream { $0.finish() } }
+}
diff --git a/native/apple/Tests/EquipoKitTests/AttachmentTests.swift b/native/apple/Tests/EquipoKitTests/AttachmentTests.swift
new file mode 100644
index 00000000..1cf39215
--- /dev/null
+++ b/native/apple/Tests/EquipoKitTests/AttachmentTests.swift
@@ -0,0 +1,197 @@
+import Foundation
+import ImageIO
+import Testing
+import UniformTypeIdentifiers
+@testable import EquipoKit
+
+@Suite struct AttachmentTests {
+ static func image(_ type: UTType = .png, width: Int = 12, height: Int = 8) throws -> Data {
+ let color = CGColorSpaceCreateDeviceRGB()
+ let context = try #require(CGContext(data: nil, width: width, height: height, bitsPerComponent: 8, bytesPerRow: width * 4, space: color, bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue))
+ context.setFillColor(CGColor(red: 0.1, green: 0.4, blue: 0.8, alpha: 1)); context.fill(CGRect(x: 0, y: 0, width: width, height: height))
+ let data = NSMutableData()
+ let destination = try #require(CGImageDestinationCreateWithData(data, type.identifier as CFString, 1, nil))
+ CGImageDestinationAddImage(destination, try #require(context.makeImage()), nil)
+ #expect(CGImageDestinationFinalize(destination))
+ return data as Data
+ }
+
+ @Test func limitsMatchTheServerAndRejectBeforeUpload() throws {
+ #expect(AttachmentLimits.maxBytes == 10 << 20)
+ #expect(AttachmentLimits.maxCount == 5)
+ #expect(AttachmentLimits.maxSide == 12_000)
+ #expect(AttachmentLimits.maxPixels == 40_000_000)
+ #expect(throws: AttachmentFailure.tooLarge) { try AttachmentFile.prepare(Data(repeating: 65, count: (10 << 20) + 1), name: "large.txt") }
+ #expect(throws: AttachmentFailure.pixels) { try AttachmentLimits.checkDimensions(width: 12_001, height: 1) }
+ #expect(throws: AttachmentFailure.pixels) { try AttachmentLimits.checkDimensions(width: 8_000, height: 5_001) }
+ #expect(throws: AttachmentFailure.type) { try AttachmentFile.prepare(Data([0, 1, 2, 3]), name: "app.exe") }
+ }
+
+ @Test func heicIsConvertedAndPNGIsPreserved() throws {
+ let original = try Self.image()
+ let png = try AttachmentFile.prepare(original, name: "screen.png")
+ #expect(png.data == original); #expect(png.mediaType == "image/png")
+ let heic = try AttachmentFile.prepare(Self.image(.heic), name: "photo.HEIC")
+ #expect(heic.mediaType == "image/jpeg"); #expect(heic.name == "photo.jpg")
+ #expect(heic.data.starts(with: [0xff, 0xd8]))
+ #expect(heic.width == 12 && heic.height == 8)
+ }
+
+ @Test func uploadAndAttachmentOnlyMessageReachFakeCoordinator() async throws {
+ let server = AttachmentServer()
+ let client = EquipoClient(transport: server, token: "fixture-bearer")
+ let file = try AttachmentFile.prepare(Self.image(), name: "screen shot.png")
+ let uploaded = try await client.upload(file) { _ in }
+ let pending = try EquipoClient.message("", attachments: [uploaded.id])
+ let sent = try await client.send(pending)
+ #expect(sent.message.attachments?.first?.id == uploaded.id)
+ #expect(await server.coordinatorImages == [file.data])
+ let reads = try await client.attachmentData(uploaded.id, preview: true)
+ #expect(reads == file.data)
+ let requests = await server.requests
+ let request = try #require(requests.first)
+ let url = try request.urlRequest(origin: server.origin)
+ #expect(url.httpBody == file.data)
+ #expect(url.value(forHTTPHeaderField: "Content-Type") == "image/png")
+ #expect(url.value(forHTTPHeaderField: "Content-Disposition")?.contains("filename") == true)
+ #expect(url.value(forHTTPHeaderField: "Authorization") == "Bearer fixture-bearer")
+ #expect(!url.httpShouldHandleCookies)
+ #expect(requests.last?.path == "/attachments/at_fixture/preview")
+ }
+
+ @MainActor @Test func draftGatesSendAndKeepsFailureForRetry() async throws {
+ let server = AttachmentServer(); await server.failNext()
+ let draft = AttachmentDraft(client: EquipoClient(transport: server, token: "fixture"))
+ await draft.add(data: try Self.image(), name: "screen.png")
+ #expect(draft.items.count == 1)
+ #expect(!draft.canSend(text: "a note"))
+ let id = try #require(draft.items.first?.id)
+ #expect(draft.items.first?.failure != nil)
+ await draft.retry(id)
+ #expect(draft.canSend(text: ""))
+ #expect(draft.readyAttachments.map(\.id) == ["at_fixture"])
+ draft.remove(id)
+ #expect(draft.items.isEmpty); #expect(!draft.canSend(text: ""))
+ }
+}
+
+actor AttachmentServer: EquipoTransport {
+ nonisolated let origin = URL(string: "https://fixture.invalid")!
+ var requests: [APIRequest] = []
+ var coordinatorImages: [Data] = []
+ private var bytes = Data()
+ private var fail = false
+ func failNext() { fail = true }
+ func send(_ request: APIRequest) async throws -> APIResponse {
+ requests.append(request)
+ if request.path == "/attachments", request.method == "POST" {
+ if fail { fail = false; throw EquipoAPIError.offline }
+ bytes = request.body ?? Data()
+ return APIResponse(status: 201, data: Data(Self.attachment.utf8))
+ }
+ if request.path == "/messages" {
+ let body = try JSONSerialization.jsonObject(with: request.body!) as! [String: Any]
+ #expect(body["attachments"] as? [String] == ["at_fixture"])
+ #expect(body["idempotency_key"] as? String == request.idempotencyKey)
+ if body["attachments"] as? [String] == ["at_fixture"] { coordinatorImages.append(bytes) }
+ var sent: Sent = try Fixture.decode("thin/sent")
+ sent.message.attachments = [try EquipoJSON.decoder.decode(MessageAttachment.self, from: Data(Self.attachment.utf8))]
+ let encoder = EquipoJSON.encoder; encoder.dateEncodingStrategy = .iso8601
+ return APIResponse(status: 201, data: try encoder.encode(sent))
+ }
+ return APIResponse(status: 200, data: bytes)
+ }
+ func lines(_ request: APIRequest) async throws -> AsyncThrowingStream<String, Error> { AsyncThrowingStream { $0.finish() } }
+ static let attachment = """
+ {"id":"at_fixture","revision":1,"kind":"image","name":"screen.png","media_type":"image/png","size":100,"sha256":"fixture","width":12,"height":8,"message_id":"","created_at":"2026-11-25T10:00:00Z"}
+ """
+}
+
+extension AttachmentTests {
+ @MainActor @Test func invalidImageNeverReachesUpload() async throws {
+ let server = AttachmentServer()
+ let draft = AttachmentDraft(client: EquipoClient(transport: server, token: "fixture"))
+ await draft.add(data: try Self.image(.gif, width: 12_001, height: 1), name: "wide.png")
+ #expect(draft.items.first?.failure == EquipoStrings.text("api.attachment_pixels"))
+ #expect(await server.requests.isEmpty)
+ }
+
+ @MainActor @Test func uploadingItemsCountTowardLimitAndRemovedItemsStayGone() async throws {
+ let server = HeldAttachmentServer()
+ let draft = AttachmentDraft(client: EquipoClient(transport: server, token: "fixture"))
+ let image = try Self.image()
+ let tasks = (0..<5).map { n in Task { await draft.add(data: image, name: "screen\(n).png") } }
+ for _ in 0..<500 {
+ if await server.pendingCount == 5 { break }
+ try await Task.sleep(for: .milliseconds(10))
+ }
+ #expect(await server.pendingCount == 5)
+ #expect(!draft.canSend(text: "a note"))
+ let sixth = Task { await draft.add(data: image, name: "sixth.png") }
+ for _ in 0..<100 {
+ if draft.notice != nil || draft.items.count > 5 { break }
+ try await Task.sleep(for: .milliseconds(10))
+ }
+ #expect(draft.items.count == 5)
+ #expect(draft.notice == EquipoStrings.text("chat.attach.too_many"))
+ for _ in 0..<500 {
+ if await server.pendingCount == draft.items.count { break }
+ try await Task.sleep(for: .milliseconds(10))
+ }
+ let id = try #require(draft.items.first?.id)
+ if case .uploading(let progress) = draft.items.first?.state { #expect(progress == 0.45) }
+ else { Issue.record("Expected an upload in progress") }
+ draft.remove(id)
+ await server.complete()
+ for task in tasks { await task.value }
+ await sixth.value
+ #expect(draft.items.count == 4)
+ #expect(!draft.items.contains { $0.id == id })
+ #expect(draft.canSend(text: ""))
+ }
+
+ @Test func messageRejectsTooManyOrDuplicateIDs() {
+ #expect(throws: (any Error).self) { try EquipoClient.message("", attachments: (0..<6).map { "at_\($0)" }) }
+ #expect(throws: (any Error).self) { try EquipoClient.message("", attachments: ["at_a", "at_a"]) }
+ }
+
+ @MainActor @Test func composerSendsTheUploadedImageAndClearsDraft() async throws {
+ let server = AttachmentServer()
+ let session = EquipoSession(account: .new(origin: server.origin, label: "Fixture"), accounts: DeviceAccounts(store: MemorySecretStore()), transport: server)
+ let data = try Self.image()
+ await session.attachments.add(data: data, name: "screen.png")
+ await session.sendFromComposer("").value
+ #expect(session.attachments.items.isEmpty)
+ #expect(await server.coordinatorImages == [data])
+ await session.attachments.add(data: data, name: "another.png")
+ session.invalidate()
+ #expect(session.attachments.items.isEmpty)
+ }
+}
+
+actor HeldAttachmentServer: EquipoTransport {
+ nonisolated let origin = URL(string: "https://held.example")!
+ private var pending: [CheckedContinuation<APIResponse, Error>] = []
+ var pendingCount: Int { pending.count }
+ func send(_ request: APIRequest) async throws -> APIResponse {
+ request.uploadProgress?.report(0.45)
+ return try await withCheckedThrowingContinuation { pending.append($0) }
+ }
+ func complete() {
+ for continuation in pending { continuation.resume(returning: APIResponse(status: 201, data: Data(AttachmentServer.attachment.utf8))) }
+ pending = []
+ }
+ func lines(_ request: APIRequest) async throws -> AsyncThrowingStream<String, Error> { AsyncThrowingStream { $0.finish() } }
+}
+
+extension AttachmentTests {
+ @Test func textDetectionMatchesServerInsteadOfRestrictingExtensions() throws {
+ for name in ["README", "main.swift", "change.patch", "error.log"] {
+ let file = try AttachmentFile.prepare(Data("let answer = 42\n".utf8), name: name)
+ #expect(file.mediaType == "text/plain")
+ }
+ #expect(throws: AttachmentFailure.type) { try AttachmentFile.prepare(Data([65, 1, 66]), name: "bad.txt") }
+ #expect(throws: AttachmentFailure.type) { try AttachmentFile.prepare(Data("not an image".utf8), name: "bad.png") }
+ #expect(try AttachmentFile.prepare(Data("not json".utf8), name: "bad.json").mediaType == "text/plain")
+ }
+}
diff --git a/native/apple/Tests/EquipoKitTests/Fixtures/attachments/large.webp b/native/apple/Tests/EquipoKitTests/Fixtures/attachments/large.webp
new file mode 100644
index 00000000..8ffb3be8
Binary files /dev/null and b/native/apple/Tests/EquipoKitTests/Fixtures/attachments/large.webp differ
diff --git a/native/apple/Tests/EquipoKitTests/MacAttachmentTests.swift b/native/apple/Tests/EquipoKitTests/MacAttachmentTests.swift
new file mode 100644
index 00000000..19ed22a8
--- /dev/null
+++ b/native/apple/Tests/EquipoKitTests/MacAttachmentTests.swift
@@ -0,0 +1,242 @@
+#if os(macOS)
+import AppKit
+import Testing
+@testable import EquipoKit
+@testable import EquipoMac
+
+@MainActor @Suite(.serialized) struct MacAttachmentTests {
+ @Test func pastedAndDroppedImagesUseTheDraftAndGateSend() async throws {
+ let server = AttachmentServer()
+ let draft = AttachmentDraft(client: EquipoClient(transport: server, token: "fixture"))
+ let composer = MacComposer(); composer.attach(draft)
+ let pasteboard = NSPasteboard.withUniqueName()
+ defer { pasteboard.releaseGlobally() }
+ pasteboard.setData(try AttachmentTests.image(), forType: .png)
+ // Both NSTextView.paste and performDragOperation call this entry point.
+ #expect(composer.acceptAttachments(pasteboard))
+ for _ in 0..<500 {
+ if !draft.readyAttachments.isEmpty { break }
+ try await Task.sleep(for: .milliseconds(10))
+ }
+ #expect(draft.readyAttachments.count == 1)
+ var sent: String?
+ composer.onSend = { sent = $0 }
+ composer.submit()
+ #expect(sent == "")
+ pasteboard.clearContents(); pasteboard.setString("ordinary text", forType: .string)
+ #expect(!composer.acceptAttachments(pasteboard))
+ }
+}
+#endif
+
+#if os(macOS)
+@MainActor final class AttachmentDraggingInfo: NSObject, NSDraggingInfo {
+ let draggingPasteboard: NSPasteboard
+ let draggingDestinationWindow: NSWindow?
+ init(_ board: NSPasteboard, window: NSWindow? = nil) { draggingPasteboard = board; draggingDestinationWindow = window }
+ var draggingSourceOperationMask: NSDragOperation { .copy }
+ var draggingLocation: NSPoint { .zero }
+ var draggedImageLocation: NSPoint { .zero }
+ nonisolated var draggedImage: NSImage? { nil }
+ var draggingSource: Any? { nil }
+ var draggingSequenceNumber: Int { 1 }
+ var draggingFormation: NSDraggingFormation = .none
+ var animatesToDestination = false
+ var numberOfValidItemsForDrop = 1
+ var springLoadingHighlight: NSSpringLoadingHighlight { .none }
+ func slideDraggedImage(to screenPoint: NSPoint) {}
+ nonisolated override func namesOfPromisedFilesDropped(atDestination dropDestination: URL) -> [String]? { nil }
+ func resetSpringLoading() {}
+ func enumerateDraggingItems(options: NSDraggingItemEnumerationOptions = [], for view: NSView?, classes classArray: [AnyClass], searchOptions: [NSPasteboard.ReadingOptionKey: Any] = [:], using block: (NSDraggingItem, Int, UnsafeMutablePointer<ObjCBool>) -> Void) {}
+}
+
+extension MacAttachmentTests {
+ @Test(arguments: [NSPasteboard.PasteboardType.png, .tiff, .fileURL])
+ func fullDragLifecycleAcceptsImages(_ type: NSPasteboard.PasteboardType) async throws {
+ let server = AttachmentServer(), board = NSPasteboard.withUniqueName()
+ defer { board.releaseGlobally() }
+ let draft = AttachmentDraft(client: EquipoClient(transport: server, token: "fixture"))
+ let composer = MacComposer(); composer.attach(draft)
+ let url = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString + ".png")
+ defer { try? FileManager.default.removeItem(at: url) }
+ if type == .fileURL { try AttachmentTests.image().write(to: url); board.writeObjects([url as NSURL]) }
+ else { board.setData(try AttachmentTests.image(type == .tiff ? .tiff : .png), forType: type) }
+ let drag = AttachmentDraggingInfo(board)
+ #expect(composer.editor.draggingEntered(drag) == .copy)
+ #expect(composer.editor.draggingUpdated(drag) == .copy)
+ #expect(composer.editor.prepareForDragOperation(drag))
+ #expect(composer.editor.performDragOperation(drag))
+ for _ in 0..<100 { if !draft.readyAttachments.isEmpty { break }; try await Task.sleep(for: .milliseconds(10)) }
+ #expect(draft.readyAttachments.count == 1)
+ }
+
+ @Test func foldersAreRefusedBeforeAddingItems() async throws {
+ let server = AttachmentServer(), board = NSPasteboard.withUniqueName()
+ defer { board.releaseGlobally() }
+ let draft = AttachmentDraft(client: EquipoClient(transport: server, token: "fixture"))
+ let composer = MacComposer(); composer.attach(draft)
+ let drag = AttachmentDraggingInfo(board)
+ board.writeObjects([FileManager.default.temporaryDirectory as NSURL])
+ _ = composer.editor.performDragOperation(drag)
+ try await Task.sleep(for: .milliseconds(40))
+ #expect(draft.items.isEmpty)
+ #expect(draft.notice == EquipoStrings.text("api.attachment_type"))
+ #expect(await server.requests.isEmpty)
+ }
+}
+#endif
+
+#if os(macOS)
+@MainActor private final class FixturePromise: NSFilePromiseReceiver {
+ let bytes: Data
+ var destination: URL?
+ var permissions: Int?
+ init(_ bytes: Data) { self.bytes = bytes; super.init() }
+ required init?(pasteboardPropertyList propertyList: Any, ofType type: NSPasteboard.PasteboardType) { fatalError() }
+ override func receivePromisedFiles(atDestination destinationDir: URL, options: [AnyHashable: Any] = [:], operationQueue: OperationQueue, reader: @escaping (URL, (any Error)?) -> Void) {
+ destination = destinationDir
+ permissions = (try? FileManager.default.attributesOfItem(atPath: destinationDir.path)[.posixPermissions]) as? Int
+ let url = destinationDir.appendingPathComponent("promise.png")
+ do { try bytes.write(to: url); reader(url, nil) } catch { reader(url, error) }
+ }
+}
+
+extension MacAttachmentTests {
+ @Test func promisedFilesUsePrivateStorageAndRemoveItAfterReading() async throws {
+ let server = AttachmentServer(), draft = AttachmentDraft(client: EquipoClient(transport: server, token: "fixture"))
+ let composer = MacComposer(); composer.attach(draft)
+ let promise = FixturePromise(try AttachmentTests.image())
+ composer.receive([promise], into: draft)
+ let destination = try #require(promise.destination)
+ #expect(promise.permissions == 0o700)
+ for _ in 0..<100 { if !draft.readyAttachments.isEmpty { break }; try await Task.sleep(for: .milliseconds(10)) }
+ #expect(draft.readyAttachments.count == 1)
+ #expect(!FileManager.default.fileExists(atPath: destination.path))
+ let board = NSPasteboard.withUniqueName(); defer { board.releaseGlobally() }
+ for type in NSFilePromiseReceiver.readableDraggedTypes {
+ board.clearContents(); board.setData(Data(), forType: NSPasteboard.PasteboardType(type))
+ let drag = AttachmentDraggingInfo(board)
+ #expect(composer.editor.draggingEntered(drag) == .copy)
+ #expect(composer.editor.draggingUpdated(drag) == .copy)
+ #expect(composer.editor.prepareForDragOperation(drag))
+ }
+ }
+}
+#endif
+
+#if os(macOS)
+@MainActor private final class HeldFilePromise: NSFilePromiseReceiver {
+ var destination: URL?
+ var reader: ((URL, (any Error)?) -> Void)?
+ override init() { super.init() }
+ required init?(pasteboardPropertyList propertyList: Any, ofType type: NSPasteboard.PasteboardType) { fatalError() }
+ override func receivePromisedFiles(atDestination destinationDir: URL, options: [AnyHashable: Any] = [:], operationQueue: OperationQueue, reader: @escaping (URL, (any Error)?) -> Void) {
+ destination = destinationDir
+ self.reader = reader
+ }
+}
+
+extension MacAttachmentTests {
+ @Test func textDragFallsThroughTheWholeNativeLifecycle() throws {
+ _ = NSApplication.shared
+ let window = NSWindow(contentRect: NSRect(x: 0, y: 0, width: 600, height: 400), styleMask: [.titled], backing: .buffered, defer: false)
+ let editor = ComposerEditor(frame: NSRect(x: 0, y: 0, width: 300, height: 200))
+ let baseline = NSTextView(frame: NSRect(x: 300, y: 0, width: 300, height: 200))
+ for view in [editor, baseline] { view.isRichText = false; window.contentView?.addSubview(view) }
+ let board = NSPasteboard.withUniqueName(); defer { board.releaseGlobally() }
+ board.setString("dragged text", forType: .string)
+ let drag = AttachmentDraggingInfo(board, window: window)
+ let entered = baseline.draggingEntered(drag)
+ #expect(!entered.isEmpty)
+ #expect(editor.draggingEntered(drag) == entered)
+ #expect(editor.draggingUpdated(drag) == baseline.draggingUpdated(drag))
+ #expect(baseline.prepareForDragOperation(drag))
+ #expect(editor.prepareForDragOperation(drag))
+ #expect(baseline.performDragOperation(drag))
+ #expect(editor.performDragOperation(drag))
+ #expect(editor.string == "dragged text")
+ #expect(editor.string == baseline.string)
+ }
+
+ @Test func promiseDeletesEachFileWhileOtherReadersStillOwnDirectory() async throws {
+ let server = AttachmentServer(), draft = AttachmentDraft(client: EquipoClient(transport: server, token: "fixture"))
+ let composer = MacComposer(); composer.attach(draft)
+ let promise = HeldFilePromise()
+ composer.receive([promise], into: draft)
+ let directory = try #require(promise.destination)
+ defer { promise.reader = nil }
+ let url = directory.appendingPathComponent("delivered.png")
+ try AttachmentTests.image().write(to: url)
+ promise.reader?(url, nil)
+ #expect(FileManager.default.fileExists(atPath: directory.path))
+ #expect(!FileManager.default.fileExists(atPath: url.path))
+ for _ in 0..<100 { if !draft.readyAttachments.isEmpty { break }; try await Task.sleep(for: .milliseconds(10)) }
+ #expect(draft.readyAttachments.count == 1)
+ }
+
+ @Test func promiseCannotReadOutsideItsPrivateDirectory() async throws {
+ let server = AttachmentServer(), draft = AttachmentDraft(client: EquipoClient(transport: server, token: "fixture"))
+ let composer = MacComposer(); composer.attach(draft)
+ let promise = HeldFilePromise()
+ composer.receive([promise], into: draft)
+ let outside = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString + ".png")
+ try AttachmentTests.image().write(to: outside)
+ defer { promise.reader = nil; try? FileManager.default.removeItem(at: outside) }
+ promise.reader?(outside, nil)
+ for _ in 0..<100 { if draft.notice != nil || !draft.items.isEmpty { break }; try await Task.sleep(for: .milliseconds(10)) }
+ #expect(draft.notice == AttachmentFailure.type.words)
+ #expect(draft.items.isEmpty)
+ #expect(await server.requests.isEmpty)
+ #expect(FileManager.default.fileExists(atPath: outside.path))
+ }
+}
+#endif
+
+#if os(macOS)
+extension MacAttachmentTests {
+ @Test func webURLDropAndPasteInsertTextWithoutAttachments() async throws {
+ _ = NSApplication.shared
+ let server = AttachmentServer(), draft = AttachmentDraft(client: EquipoClient(transport: server, token: "fixture"))
+ let composer = MacComposer(); composer.attach(draft)
+ let window = NSWindow(contentRect: NSRect(x: 0, y: 0, width: 400, height: 300), styleMask: [.titled], backing: .buffered, defer: false)
+ composer.frame = NSRect(x: 0, y: 0, width: 400, height: 100)
+ window.contentView?.addSubview(composer)
+ composer.layoutSubtreeIfNeeded()
+ let url = URL(string: "https://example.com/photo.png")!
+ let board = NSPasteboard.withUniqueName(); defer { board.releaseGlobally() }
+ board.writeObjects([url as NSURL])
+ let drag = AttachmentDraggingInfo(board, window: window)
+ #expect(!composer.editor.draggingEntered(drag).isEmpty)
+ #expect(!composer.editor.draggingUpdated(drag).isEmpty)
+ #expect(composer.editor.prepareForDragOperation(drag))
+ #expect(composer.editor.performDragOperation(drag))
+ #expect(composer.text == url.absoluteString)
+ #expect(!composer.acceptAttachments(board))
+
+ // NSTextView.paste reads the general pasteboard. Preserve it in memory
+ // for this short synchronous test; no clipboard contents are logged.
+ do {
+ let clipboard = NSPasteboard.general
+ let saved = (clipboard.pasteboardItems ?? []).map { item in
+ item.types.compactMap { type in item.data(forType: type).map { (type, $0) } }
+ }
+ defer {
+ clipboard.clearContents()
+ let restored = saved.map { values in
+ let item = NSPasteboardItem()
+ for (type, data) in values { item.setData(data, forType: type) }
+ return item
+ }
+ clipboard.writeObjects(restored)
+ }
+ clipboard.clearContents(); clipboard.writeObjects([url as NSURL])
+ composer.setText("Link: ")
+ composer.editor.setSelectedRange(NSRange(location: 6, length: 0))
+ composer.editor.paste(nil)
+ #expect(composer.text == "Link: " + url.absoluteString)
+ }
+ #expect(draft.items.isEmpty)
+ #expect(await server.requests.isEmpty)
+ }
+}
+#endif
diff --git a/native/ios/UITests/AttachmentSourceUITests.swift b/native/ios/UITests/AttachmentSourceUITests.swift
new file mode 100644
index 00000000..c7dbb08a
--- /dev/null
+++ b/native/ios/UITests/AttachmentSourceUITests.swift
@@ -0,0 +1,21 @@
+import XCTest
+
+/// Runs against the production composer with the debug fake transport.
+final class AttachmentSourceUITests: XCTestCase {
+ @MainActor func testMenuPresentsPrivatePhotosPicker() throws {
+ let app = XCUIApplication()
+ app.launchEnvironment["EQUIPO_ATTACHMENTS_FIXTURE"] = "sent"
+ app.launch()
+ XCTAssertTrue(app.buttons["Attach"].waitForExistence(timeout: 10))
+ app.buttons["Attach"].tap()
+ XCTAssertTrue(app.buttons["Photos"].waitForExistence(timeout: 5))
+ capture("iphone-add-menu")
+ app.buttons["Photos"].tap()
+ XCTAssertTrue(app.navigationBars["Photos"].waitForExistence(timeout: 10))
+ capture("iphone-photos-picker")
+ }
+ @MainActor private func capture(_ name: String) {
+ let attachment = XCTAttachment(screenshot: XCUIScreen.main.screenshot())
+ attachment.name = name; attachment.lifetime = .keepAlways; add(attachment)
+ }
+}
diff --git a/native/ios/project.yml b/native/ios/project.yml
index 174305ff..1759e072 100644
--- a/native/ios/project.yml
+++ b/native/ios/project.yml
@@ -56,6 +56,8 @@ targets:
CFBundleName: Equipo
# HTTPS only, through the system: exempt from export documentation.
ITSAppUsesNonExemptEncryption: false
+ # COPY APPROVED (Luna, 2026-11-25): native.attach.camera_usage
+ NSCameraUsageDescription: Use your camera to take a photo to attach to your message.
# Interface text is English in slice 1; dates and numbers follow the
# reader's locale through Foundation's format styles.
CFBundleLocalizations:
@@ -94,3 +96,27 @@ targets:
- en
NSExtension:
NSExtensionPointIdentifier: com.apple.widgetkit-extension
+
+ AttachmentSourceUITests:
+ type: bundle.ui-testing
+ platform: iOS
+ sources: [UITests]
+ dependencies:
+ - target: EquipoPhone
+ settings:
+ base:
+ PRODUCT_BUNDLE_IDENTIFIER: works.oficina.equipo.attachment-tests
+ GENERATE_INFOPLIST_FILE: true
+ TEST_TARGET_NAME: EquipoPhone
+schemes:
+ EquipoPhone:
+ build:
+ targets:
+ EquipoPhone: all
+ AttachmentSources:
+ build:
+ targets:
+ EquipoPhone: all
+ AttachmentSourceUITests: [test]
+ test:
+ targets: [AttachmentSourceUITests]
diff --git a/native/scripts/check-parity.py b/native/scripts/check-parity.py
index 64023c8a..1a90115f 100755
--- a/native/scripts/check-parity.py
+++ b/native/scripts/check-parity.py
@@ -22,7 +22,7 @@ for key in sorted(set(re.findall(r'"(work\.reason\.[^"]+)":', copy))):
if key not in strings:
problems.append(f'{key}: native must carry every reviewed stop reason')
for key, text in sorted(strings.items()):
- if not key.startswith(('chat.card.', 'chat.paste.', 'work.tl.', 'roster.', 'projects.', 'work.star.', 'api.', 'nav.projects', 'chat.connections.connected', 'counts.unavailable', 'team.close', 'work.pause.', 'work.reason.', 'work.needs.', 'chat.held.', 'work.hold.', 'work.stage.', 'time.', 'work.hold.run_now', 'work.recover')):
+ if not key.startswith(('chat.card.', 'chat.paste.', 'chat.attach.', 'work.tl.', 'roster.', 'projects.', 'work.star.', 'api.', 'nav.projects', 'chat.connections.connected', 'counts.unavailable', 'team.close', 'work.pause.', 'work.reason.', 'work.needs.', 'chat.held.', 'work.hold.', 'work.stage.', 'time.', 'work.hold.run_now', 'work.recover')):
continue
found = re.findall(r'"' + re.escape(key) + r'":\s*"((?:[^"\\]|\\.)*)"', copy)
if len(found) != 1:
diff --git a/native/scripts/strings.json b/native/scripts/strings.json
index 8afa74bb..0bc02699 100644
--- a/native/scripts/strings.json
+++ b/native/scripts/strings.json
@@ -352,5 +352,23 @@
"native.step.log_tail": "Last lines of the log",
"time.when_in": "%@ (%@)",
"team.close": "Close",
- "work.recover": "Recover"
+ "work.recover": "Recover",
+ "chat.attach.add": "Attach",
+ "chat.attach.image": "Photo or image",
+ "chat.attach.file": "File",
+ "chat.attach.list": "Attachments",
+ "chat.attach.remove": "Remove %@",
+ "chat.attach.uploading": "Uploading…",
+ "chat.attach.failed": "Could not upload. Try again.",
+ "chat.attach.too_many": "At most 5 files in one message.",
+ "api.attachment_too_large": "That file is over 10 MB.",
+ "api.attachment_type": "Equipo takes images (PNG, JPEG, WebP, GIF) and text, Markdown, CSV, JSON, log and PDF files.",
+ "api.attachment_heic": "HEIC photos cannot be read yet. Share it as a JPEG and try again.",
+ "api.attachment_pixels": "That image is too large: at most 12,000 pixels on a side and 40 megapixels.",
+ "api.attachment_limit": "Too many files are waiting to send. Send or remove some first.",
+ "native.attach.photos": "Photos",
+ "native.attach.camera": "Camera",
+ "native.attach.files": "Files",
+ "native.attach.paste": "Paste",
+ "native.attach.camera_usage": "Use your camera to take a photo to attach to your message."
}