sharemap_maplib_flutter 1.3.0
sharemap_maplib_flutter: ^1.3.0 copied to clipboard
A MapLibre-based map widget for Flutter integrating ShareMap APIs, supporting dynamic POI layer toggling, HMAC-signed requests, and custom style loading.
Chưa phát hành #
1.3.0 — 2026-11-25 #
Nâng cấp dependency MapLibre #
- Nâng
sharemap_maplibre_gllên0.28.0+sharemap.1, dùng bản đã publish với hỗ trợtransformRequest. - Nâng mức SDK tối thiểu lên Dart 3.12.0 và Flutter 3.44.0 theo dependency.
Thêm — route 1.5: routeType: "direct-route" — tuyến nối thẳng cho máy bay · tàu hoả · tàu thuỷ (2026-11-17) #
- Theo spec
ai-map-protocol/docs/superpowers/specs/2026-11-17-route-direct-route-design.md, components doc 10.6 "Chế độdirect-route" và thiết kếsharemap-route2.10 / 3.6 / 6.9.kComponentVersions['route']→1.5. Như lib React. - Hình học engine tự sinh (
component_direct_route.dart, thuần Dart):pathModegeodesic(mặc định — slerp trên mặt cầu,segments: "auto"=clamp(ceil(góc tâm × 2), 8, 128); hai điểm đối cực > 179.9° → đoạn thẳng Mercator) ·arc(Bézier bậc hai trong Web Mercator, đỉnh vòm caobulge × L,sidetrái / phải chiều đi,auto= 64).curve { bulge, side, segments }giải theo từng khoá: chặng → route → mặc định (0.15,left,auto). Kinh độ mở cuộn theo cung ngắn rồi cắt hai nhánh tại ±180°. Đỉnh sinh làm tròn 6 chữ số, điểm neo giữ nguyên. - Điểm neo = vị trí các điểm dừng khi route có ≥ 2 điểm dừng và mọi điểm đều biết vị trí (kể cả
markerRef); còn tham chiếu đang chờ / không điểm dừng → các đỉnhcoordinates(khi đó chặng không áp). Marker được trỏ bị dời / tới muộn → đường cong tính lại. Hai điểm neo cách nhau < 1 m → khúc không vẽ. Không có đoạn nối (stopConnectorsvô hiệu). - Biên dịch: mỗi khúc một feature
{id}/direct/{i}(sm:role: "line",sm:part: "direct",sm:section: i,sm:option: 0;MultiLineStringhai nhánh khi bị cắt tại ±180°). Nét của khúc gộp năm tầngroute.default.direct← preset.direct←leg.vehicles[vehicleType].direct←style.direct←legs[i].style.direct. Nhãn + mũi tên chạy dọc polyline đã sinh; nhãn không chạy qua khúc có chú thích. Chú thích chặng:attheo chiều dài dọc đường cong của khúc (đo trong Web Mercator);rotate: true→ icon xoay theo phương vị tiếp tuyến (0–359°, glyph vẽ chĩa lên) và xoay cùng bản đồ; chip luôn thẳng đứng, dạt trái khi tiếp tuyến lệch trục dọc < 30°.bbox/fitBoundstrên polyline đã sinh + điểm dừng, kinh độ mở cuộn (tuyến qua 180° có kinh độ ngoài ±180 — camera ôm Thái Bình Dương). Chấm / huy hiệu số mặc định = màu nét của khúc đầu tiên (chặngfrom: 0);derived.colorcũng vậy. Markeralongvàanimationtrêndirect-routechạy theo polyline đã sinh. - Pha A (mọi lỗi
SCHEMA_INVALIDtại đúng khoá):pathMode/curve/style.directngoàidirect-route;style.line|done|…trongdirect-route;plane·train·shipchỉ trongdirect-route,bus·coach·truck·vanchỉ ngoài;legs[].pathMode|curve|stylechỉ trongdirect-route; chặngto ≠ from + 1;direct-routekhông nhậnprogress,alternatives,selectedOptionIndex ≠ 0,day,transition;casing.widthPx ≥ widthPxkiểm trên nét đã gộp của route và từng chặng.updateđổi loại rời / vàodirect-route: bỏpathMode,curve, ghi đè nét của loại cũ,legsvề[](trừ khi gửi kèmlegs).update curvethay cả object. - Theme: token
route.default.direct+route.default.leg.vehicles.{plane,train,ship}(glyph, màu,direct); presetmutedkhaidirect.opacity: 0.35. Theme riêng chưa khai → số đosharemap(kDirectFallback,LegStyle.vehicleDirect). Bộ glyph thêmplane·train·ship(61 glyph) — dùng choicon.glyphcủa marker vàicon.namecủa chú thích.mapContext:routeType: "direct-route",legsgọn vớivehicleTypemới (không xuấtpathMode/curve). - Layer mới, dựng lười (MapLibre Native không đọc
line-dasharray/line-captheo feature): nét đứt của khúc có mẫu / đầu nét khác hằng của layerdashlên layer biến thểsm-route-{grp}-dash-{a}x{b}-{cap}(feature mangsm:dvar) —plane[2.5, 2],train[0.5, 1.5]đầubutt,ship[0.3, 1.7]vẽ đúng mẫu. Icon chú thích xoay nằm ởsm-route-{grp}-annotation-map(sm:role: "annotation-map",icon-rotation-alignment: map,icon-pitch-alignment: viewport); góc nướng vào ảnh vẽ ở tỉ lệ điểm ảnh của máy. - Khoảng lệch còn lại (bảng B14 của
doc/ios-android-chua-ho-tro.md): layercasingvà layerline(nét liền) vẫn mộtline-caphằng theo theme (round) — viền của khúctrain(đầubutt) có đầu tròn nhô ~3 px ở hai mút (nằm dưới marker điểm dừng), nét liềncap: "butt" | "square"vẫn vẽround; route loại khác (walking, phương án B…) vẫn dùng một mẫu đứt chung như trước. Icon xoay: bản đồ hướng bắc thì ảnh lấy mẫu 1:1; khi người dùng xoay bản đồ MapLibre nội suy LINEAR lúc xoay (mềm hơn nhẹ). Chưa đo trên máy thật. - Facade:
SMRoute(pathMode:, curve:). Demo web: màn "Route 1.5" (direct_route_screen.dart) — bay TP.HCM → Cam Ranh (arc,markerRef, icon xoay + chip), tàu hoả Sài Gòn → Nha Trang, Tokyo → Los Angelesgeodesicqua 180°, ba điểm dừng bay + tàu thuỷ. Hằng nhúng theme / bộ glyph / schema theme / schema command và fixture ví dụ sinh lại từ protocol.
Đổi — popup 1.2: thẻ neo marker mặc định đóng, mỗi lúc một thẻ neo mở #
- Popup có
anchorTomàaddkhông ghiopen→ đóng; người dùng bấm marker mới mở (openOnAnchorClick). Popup không neo bỏopenvẫn mở. Chỉ áp lúcadd—updatebỏopengiữ trạng thái đang có. App nào cần thẻ neo mở sẵn phải ghiopen: true(cả facadeSMPopup(anchorTo: …)). - Người dùng mở một thẻ neo (bấm marker,
ComponentEngine.setOpen(id, true)) → engine đóng các thẻ neo khác đang mở (closeby: "user"). Thẻ không neo và thẻ mở bằng lệnh không bị ảnh hưởng. Tắt bằngShareMapLibre(exclusiveAnchoredPopups: false)/ComponentEngine(exclusiveAnchoredPopups: false). - Xuất cấu hình (
export, đồng bộ) inopenkhi khác mặc định mới; trần 10 popup mở cùng lúc đếm theo trạng thái mở thật. kComponentVersions['popup']→1.2.
1.2.1 #
- SHAR-2030 —
ShareMapLibre.layerCodesnhận URL tile POI ShareMap đầy đủ choget_pois_layer_mvtvàget_pois_layer_by_admin_mvt. Nguồnsharemaplayersdùng URL POI ShareMap đầu tiên trong danh sách, giữ tham số truy vấn đã truyền. Khi URL cóthoặctokenkhác rỗng, SDK dùng token đó và bỏ qua bước gắn token tự động và ký HMAC cho request. - Map Agent — Thêm API gợi ý
@mentionvà dựngpayload.referencescho marker, route, trip-plan và popup độc lập. Chat giữ nguyên nội dung hiển thị và có thể gửi prompt riêng cho agent. Với câu đang chờ, tham chiếu được dựng lúc gửi để dùng trạng thái bản đồ mới nhất. - Hiển thị marker — Canh mũi ghim neo đáy đúng tọa độ, đồng bộ hình ghim dự phòng với sprite và tính lại khoảng cách cho popup neo vào marker.
- Phiên bản package/SDK là
1.2.1; AI Map Protocol vẫn là2.0.0.
1.2.0 #
Lưu ý nâng cấp từ 1.1.0 #
ShareMapLibreController.refreshTiles()không còn tham sốvisiblePoiTypes.AiSharemapAgent/AiSharemapAgentOptionsđổi tên thànhAiShareMapAgent/AiShareMapAgentOptions.- Phiên bản package/SDK là
1.2.0; phiên bản AI Map Protocol vẫn là2.0.0.
Thêm — đổi server layers: ShareMapLibre.setLayersBaseUrl (2026-10-28) #
- Trước đây host layers cố định theo
mode(layers.sharemap.live/dev-layers.sharemap.live). NayShareMapLibre.setLayersBaseUrl(url)đổi cho cả thư viện: tile POI củalayerCodes({url}/sharemap.get_pois_layer_mvt/{z}/{x}/{y}?…, giữ tiền tố đường dẫn / cổng /http) vàShareMapPoiServicekhông tự khaibaseUrl; map đang mở có layer POI tải lại style ngay;null= về mặc định. Đọc lại bằngShareMapLibre.layersBaseUrl(mode).ShareMapPoiService(baseUrl: …)đặt riêng một service. URL sai (khônghttp(s), thiếu host, có query / fragment) →ArgumentError. Xác thực không đổi:x-api-keyHMAC như cũ, token?t=chỉ cho domain layers của ShareMap. React không cần tương đương: app tự truyền URL tile quaattachSharemapPois.
Thêm — marker 1.4 thẻ nhãn + route 1.4 mũi tên chỉ hướng (2026-10-28) #
- Theo
sharemap-ai-design-component(marker 3.6 / 3.6.1, route 2.9, animation 2.2) và protocolmarker.md6.2 "Thẻ nhãn",route.md7.2 "Mũi tên chỉ hướng".kComponentVersionsmarker / route1.4. Như lib React. - Thẻ nhãn:
labelnhận{ title, subtitle?, color?, backgroundColor?, border?, position?, pointer? }— ảnh engine vẽ (sm-labelcard-…,RasterImage.content= hộp phần đục), feature{id}/label(sm:role: "label") của chính marker, không xoay, không theoscale; icon căn theo bản đồ → thẻ ở nhómviewport. KhegapPx(5) đo tới mép phần đục của icon (alpha ≥ 10 %,opaqueBox) theo góc đang vẽ (rotatedVerticalExtents, trừ hướng bản đồ khi icon căn theo bản đồ); animation tính lạism:offsetmỗi khung. Token thememarker.labelCard;mapContextlabel =title · subtitle. - Mũi tên:
metadata.showDirectionArrows+arrowColor/arrowSize/arrowSpacingPx/arrowRotate/arrowImageUrl(lỗi tải → chevron dựng sẵn). Khoásm:arrow(+sm:asize/sm:arot/sm:aspacekhi khác theme) trên mọi feature nét; layer mớism-route-{grp}-arrow(biến thể-{N}cho khoảng lặp khác) giữalinevàlabel, có bản chuyển động. Nhóm z0 nay 8 layer. Token themeroute.default.arrow. - Icon sprite dùng thẳng (không qua rasterizer) đo phần đục từ atlas (
spriteContentBox). Facade:SMMarker.label/setLabelnhận chuỗi hoặc map, helperSMLabel.card(title, subtitle: …). Demo web Components: xe tải mang thẻ nhãn, tuyến giao có mũi tên. Hằng nhúng theme / schema theme / schema command sinh lại từ protocol.
Sửa — camera follow của animation làm icon POI giật (Flutter web) #
- MapLibre GL JS lấy mẫu ảnh icon
NEARESTkhi bản đồ chỉ dịch màpitch == 0; follow dời camera lẻ pixel mỗi khung làm icon POI nhảy lệch khỏi nhãn. Web: khi bản đồ phẳng tuyệt đối, follow đặt kèm pitchkFollowPitchEpsilon(0.001°) → iconLINEAR, trôi mượt cùng bản đồ; camera vẫn trôi lẻ pixel (không làm tròn — làm tròn thì cả bản đồ nhích từng nấc). Hết marker để theo (tạm dừng, tới đích, tắt follow, gỡ animation) thì pitch về 0. Native không đổi (MapLibre Native lấy mẫu LINEAR khi camera đang đổi). Như lib React.
Thêm — component animation 1.0: marker chạy theo route (2026-10-27) #
- Component mới
animation(components doc chương 15 —ai-map-protocol/themes/components/animation.md; specdocs/superpowers/specs/2026-10-27-animation-component-design.md):{ type: "animation", id: "{origin}-animation-{17 số}", bindings: [{ routeId, markers: [{ markerId, at?, speed (km/h), easing?, rotate?, playing? }] }], playing?, fill? (hold · reset), follow? ({ mode: center · edge, markerId }), events? (start · pause · resume · finish), properties?, tags? };seek∈ [0, 1] là chỉ thị củaupdate(không lưu). Không vẽ gì riêng (như trip-plan); route là route thường (visible: falsevẫn cho hình học);kComponentVersions.animation = '1.0', protocol vẫn2.0.0. - Pha A (15.2, không mã lỗi mới): hình dạng (marker thiếu
speed,durationMs,easing/filllạ,seektrongadd/ ngoài [0, 1],removekèm trường) →SCHEMA_INVALID; trên sổ sau action: route / marker thiếu →COMPONENT_NOT_FOUND, khác origin →NAMESPACE_VIOLATION, route < 2 điểm khác nhau / markeralong/ khônglngLat/ là điểm dừng sở hữu →SCHEMA_INVALID, marker trong hai binding (mọi animation) →COMPONENT_DEPENDENCY_CONFLICT; gỡ (hay đổi hỏng) route / marker còn trongbindings→COMPONENT_DEPENDENCY_CONFLICTtại phần tử gây ra,repairnêu id animation; gỡ cùng lúc animation + route + marker thì được. Trần 20 animation mỗi origin, 50 binding / 200 marker mỗi animation (PAYLOAD_TOO_LARGE).getanimation chỉ nhậnid·tags·limit. update bindingsgộp theo khoá (mergeAnimationBindings): binding theorouteId, marker theomarkerIdgộp từng trường,nullvề mặc định,{ markerId | routeId, remove: true }bỏ, binding hết marker bỏ, hết binding →SCHEMA_INVALID, marker trùng do gộp →COMPONENT_DEPENDENCY_CONFLICT(trùng trong mộtadd→SCHEMA_INVALID). Component Memory:byAnimatedMarker/byAnimatedRoute,animationOf(markerId),animationsOn(routeId),ComponentEntry.animationBindings.- Chạy (
component_animation.dart, hàm thuần + đồng hồ của host): quãng đường địa lý haversine (R = 6371008.8 m) trên hình học đang vẽ (phương án chọn),s(t) = s₀ + D · ease(t / T),T = D / v; easingcubic-bezierCSS (khớp bảng 100 m / 36 km/h của tài liệu thiết kế); tạm dừng đóng băng thời gian lẫn đường cong; đổispeed/easinggiữ vị trí (đoạn mới); đổiat/ binding / hình học / phương án route /addlại → chạy lại từat(phát lạistart);seekdời mọi marker,1phátfinishtừng marker chưa xong (kể cả đang dừng),< 1đưa marker đã xong về chạy;fill; marker chưa chạy đứng ở điểmat; gỡ animation / bỏ khỏi binding → vềlngLat;rotate= hướng cạnh (+rotation, ở đỉnh lấy cạnh sau, căn theo bản đồ);reducedMotionnhảy thẳng tới cuối (vẫn phát sự kiện). - Vẽ: marker đang chạy biên dịch vào
sm-anim-points(layersm-anim-marker-{grp},icon-rotatetheo dữ liệu, nay nhận bấm — bấm xe = bấm marker), mỗi khung mộtsetGeoJsonSourcecho mọi marker; dừng / xong → biên dịch lại vềsm-points(im lặng). Vòng khung hìnhTimercùng nhịpframeIntervalvớitransition, tự dừng khi không còn marker chạy;tickAnimations()cho test. Marker trong binding (chạy hay không) không kéo được; popup neo chạy theo;visible()đếm cả nó. Đang chạy →hasTransitions(mapContextsettled: false, như layer animation). follow:centermỗi khungmoveCamera(newLatLng);edgehỏitoScreenLocationBatchtối đa mỗi 100 ms, marker cách mép < 120 px thìmoveCamera(scrollBy)vừa đủ về lại 120 px; không xếp hàng lời gọi camera. Ngay sau một lệnh animation cófollow, camera tới marker được theo một lần (kể cả khi nó đứng yên).- Sự kiện (15.5): vỏ chung
type: "animation"+ComponentEvent.params({ routeId, markerId },finishthêmremaining), chỉ sự kiện đã khai, sau sự kiện vòng đời của đoạn; không phátupdatedtheo khung;updatechỉ cóseekáp nhưng không phátupdated(khôngskippedByDiff);seek: 1với marker chưa từng chạy chỉ phátfinish. mapContext(15.6): mục{ type, id, origin, visible: true, playing, fill, routeCount, markerCount, finished, follow? }, marker trong binding manganimatedBy;count.byType.animation.get→state: { finished }.- Đồng bộ: cấu hình animation đi như mọi component (vị trí không bao giờ ghi); áp từ xa dùng
animationSyncItem(bản vá kèmremove/nullvìbindingsgộp theo khoá); animation tới trước route / marker thì chờ; gỡ từ xa gỡ animation trước. Người dùng gỡ marker / route đang chạy (removeByUser, nút Xóa) → animation bỏ nó (dropAnimatedRemoved, hết binding thì gỡ theo). - Facade
SMAnimation(+SMAnimationBinding,SMAnimationMarker):play/pause/seek(k)/restart/setSpeed/setEasing/setMarkerPlaying/setFill/setFollow/replace,onStart/onPause/onResume/onFinish(tự khaievents). Xuất thêmcubicBezier,animationEase,haversineMeters,AnimationPath,kAnimationEasings/kAnimationFills/kAnimationFollowModes,ComponentEngine.animationState(id). - Schema lệnh nhúng (
amjson_command_schema.dart) sinh lại từ protocol; fixture schema + ví dụcomponent-animation*.
Thêm — đồng bộ Component Memory nhiều máy + API host còn thiếu so với React (2026-10-27) #
- Đồng bộ component (sharemap-mymap/docs/component_memory_sync.md mục 3–13, port
component/sync/*của React): hợp đồngComponentSyncTransport(user?·clientId·subscribe(onChanges, onError)lần đầuinitial·write(ops, mirror)),SyncDoc/SyncDocMeta/SyncBatch/SyncOp(SyncSetOp·SyncDeleteOp) /MirrorOp/RemoteChange—toJson/fromJsonđúng hình doc của bản web (nháp khôngbatch.seq/by.client). Codec:kSharedTag,isSyncedEntry(ai-*∪app-*tagshared, trừ điểm dừng),toDocBody(trip-planroutes→routeIdstheoday, popup bỏopen),nestPlans,encodeNestedArrays/decodeNestedArrays(quy ước{ "$a": [...] }). ComponentEngine.sync(transport, {onError, onStatus}) → ComponentSyncStop(void Function({bool keepComponents})): gom sự kiện vòng đời + lớp phủ state theo microtask thành MỘTwrite, chờ snapshot đầu rồi mới ghi, khử vang theoclient, áp từ xa từng gói (gói hỏng → áp lẻ, item hỏng bỏ qua +onError), popup chờ marker neo tới sau, popup từ xa mặc định đóng, đổi chủ mang dấu gốc, ẩn / hiện theovisible;connecting→live→error(nghe hỏng: tự dừng, gỡ component đã đồng bộ). Dừng mặc định gỡ mọi component đã đồng bộ của kho;keepComponents: truechỉ huỷ nghe.- Áp từ xa:
ComponentEngine.applyRemoteComponents(actions, origin) → Future<RemoteApplyResult>— Pha A vớiComponentValidateEnv(remote: true, pendingRefs: true)(cấu hình đi nguyên, tham chiếu marker đang chờ được nhận) rồi Pha B, phát sự kiện như thường. Khoá chung với batch:ComponentHost.withRemoteLock/runHostAction/applyingRemote(ShareMapEnginehiện thực) —executeBatchchờ lần áp từ xa đang chạy, lần áp chờ batch đang chạy;adopt/removeByUserđirunHostActionđể sự kiện của chúng không bị coi là «từ xa».adoptRemote(id, AdoptedStamp). ComponentEntry.adopted(AdoptedStamp {by, at}— «người dùng đã chọn», 13.6) sống qua update / thay / kéo / đổi chủ; sync ghi khi người dùng máy này adopt.ComponentEngine.onStateChanged(listener): kéo / đặt marker, chọn phương án, mở / đóng popup (người dùng /setOpen/ bấm marker), nhập ô — những thay đổi không phátupdated.ShareMapLibre(sync:, onSyncError:, onSyncStatus:)—ComponentSyncBinding(portsyncBinding.ts): đổi transport (identity) → dừng sync cũ (gỡ component kho cũ) rồi gắn mới; widget gỡ → chỉ huỷ nghe. Cósyncthì engine được dựng.- Package mới
packages/sharemap_maplib_flutter_firebase(lõi KHÔNG phụ thuộc Firebase):firestoreComponentSync( firestore:, mapRef:, userId:, clientId:, mirror:)— cùng layoutsharemaps/{id}/mapComponents/{componentId}+mapComponentsSeqcấp trong transaction,by.client,updatedAtserverTimestamp,$a, hook gươngFieldUpdateghi cùng transaction. Phần chạm SDK sauFirestoreSyncBackend(bản thậtCloudFirestoreSyncBackend), test bằng backend giả. exportOf(id)(cấu hình đã gộp lớp phủ,nullkhi không có),setHidden(id, hidden)(ẩn chỉ trên lớp vẽ máy này:ComponentEntryState.hidden,visible/ export /mapContextgiữ, không sự kiện, khôngonStateChanged, sống qua update kể cả từ xa, marker ẩn kéo theo popup neo;falsekhi id không có),visible({type}) → Future<List< ComponentEntry>>(queryRenderedFeaturesInRecttrên layer cố định trừ anim / đoạn nối + popup đang mở; cầnviewportSize— thiếu thìStateError),newId(type).GlyphIcon(widget,CustomPaintervector — sắc ở mọi pixelRatio) +glyphSvgMarkup(glyph:, color:, size:, style:)(trùng từng ký tự bản React — test so fixture sinh từdist/glyphs.js) +paintGlyphIcon: một hình học chung với ảnh engine (rasterizer nay gọipaintGlyphIcon).- Khác bản web:
visible()bất đồng bộ;Transaction.updatecủa FlutterFire không nhậnFieldPathnên doc gốc ghi bằngset(…, SetOptions(mergeFields: [FieldPath…]))(key có dấu chấm vẫn an toàn; doc gốc chưa có → lỗi nhưupdate); khoá so thân doc dùng JSON chuẩn hoá (khoá sắp xếp) thayJSON.stringify— doc từ kho khác thứ tự khoá không gây ghi thừa; tham sốuserIdthayuser: { id }.
Thêm — route 1.3: chặng đa phương tiện legs[] + chú thích chặng annotations[] (theo React, 2026-10-27) #
route.legs[]{ from, to?, vehicleType?: bus|coach|truck|van, annotations? }theo chỉ sốstops[](specai-map-protocol/docs/superpowers/specs/2026-10-27-route-legs-annotations-design.md). Pha A: khoá lạ,vehicleTypelạ,placement≠center, chữ > 60, chú thích không ra icon →SCHEMA_INVALID;icon.namengoài bộ glyph →ICON_NOT_FOUND; sau gộp0 ≤ from ≤ n−2,from < to ≤ n−1, cặp(from, to)không trùng.- Gộp:
legsthay cả mảng,null/[]bỏ;updategửistopskhông kèmlegsmà dãy id điểm dừng đổi → bỏlegs(luật nằm ở Pha A vì cấu hình route Flutter không mangstops). Gỡ điểm dừng ngoài command route (marker sở hữu / marker được tham chiếu) → chặng chạm nó bỏ, chỉ số sau lùi (legsWithoutStops);updated["legs", "stops"]. - Hiển thị: feature
{routeId}/leg/{i}/annotation/{k}(+/label) trênsm-lines, layer mớism-route-{grp}-annotationtrênlabel(không bản anim, nhận bấm = bấm route, không đổi phương án đang chọn). Neo ở đoạn thẳng ngang dài nhất của chặng (legAnchorPoint); chip trên / dưới icon, dạt trái khi đoạn dọc — độ dời nướng vào lề trong suốt của ảnh, khôngsm:offset. Nhãn tuyến thành phần bù (MultiLineString). Ảnhsm-legicon-{glyph}-{băm}/sm-legchip-{băm}vẽdart:uitheopixelRatio. - Theme
route.default.leg(LegStyle, theme riêng thiếu → số đosharemap); bộ glyph thêmcoach,truck,van(58);mapContextroute cólegs: [{ from, to, vehicleType?, label? }];kComponentVersions.route = '1.3'. FacadeSMRoute(legs: …)như bản web. - Khác bản web: layer
annotationđểicon-size= hằng tỉ lệ ảnh của engine (1 / pixelRatiotrên Android / web — bytesaddImagelà 1x;1trên iOS) thay cho1cố định.
Thêm — marker 1.3: icon glyph (tròn nền màu + glyph trắng) (theo React 2.2.0, 2026-10-24) #
- Icon
{ glyph, color?, sizePx? }:glyph=locationhoặc một trong 54 loại place — bộ glyph nhúngcomponent_glyphs_sharemap.dart(GENERATED từai-map-protocol/themes/glyphs/sharemap-glyphs.json, test so fixture). Tên lạ →ICON_NOT_FOUND. - Thiếu
color: Pha A ghi màu loại hay màu cố định theo id (distinctGlyphColor, trùng bản JS) vào cấu hình.ComponentEngine(defaultMarkerIcon: 'location'): markeraddkhông icon nhận{ glyph: 'location', color }(không áp choupdate, điểm dừng route).ComponentValidateEnv.remotecho đường áp từ xa. - Vẽ vector (
path_parsing→Path) ởpixelRatio, ảnhsm-glyph-{tên}-{màu}-{Ø}; nhãn cách mép dưới hình tròn 3 px; huy hiệu route 1.2 theo hộp tròn.capabilities.glyphs[], token thememarker.default.glyph,kComponentVersions.marker = '1.3'. - Phụ thuộc mới:
path_parsing ^1.1.0.
Thêm — route 1.2 / marker 1.2: điểm dừng tham chiếu marker + hàng huy hiệu số (theo React 2.1.0, 2026-10-24) #
route.stops[]nhận{ type: "markerRef", id }— trỏ marker đã có (place đã lưu, marker AI); route không vẽ lại, không sở hữu. Pha A: đúng hai khoá,idlà id marker (SCHEMA_INVALID); lệnhaitrỏ marker không có trong sổ /items→COMPONENT_NOT_FOUNDtạistops/i/id(chỉ khi route thật sự gửistops); host (app) cho phép tham chiếu đang chờ;ComponentValidateEnv.pendingRefscho đường đồng bộ (Flutter chưa có đường sync — cờ để sẵn). Routeaitrỏ được placeapp. Trần số:stopNumberStart + stops.length − 1 ≤ 99đếm cả tham chiếu.- Sổ:
ComponentEntry.stopIdslà thứ tự đầy đủ củastops(sở hữu + tham chiếu),stopRefsđánh dấu vị trí tham chiếu (isRefAt,refIds,ownedStopIds); số trên chấm =stopNumberStart+ vị trí đầy đủ (map =mapContext).ComponentMemory.byRef/refsTo(markerId)(theoseq, có cả khi marker chưa tới). - Vòng đời: gỡ marker được trỏ (command, cascade,
ai.clearContent,clear, người dùng) → mọi route trỏ tới bỏ điểm dừng đó, đánh số lại, mỗi route mộtupdated["stops"](không phát khi route là phần tử của đoạn); gỡ / ẩn route → huy hiệu của nó biến, marker ở lại (cascadedchỉ đếm điểm dừng sở hữu); marker được trỏ dời / ẩn / tới muộn → route dựng lại đoạn nối; «Chọn kế hoạch» (adopt) đổi chủ cả markeraiđược trỏ + popup neo nó;exportgiữ{ type: "markerRef", id }. - Hiển thị: điểm dừng sở hữu
{ color }/ bỏ trống /"none"vẫn là chấm có số; icon khác (ảnh, sprite, emoji, template) giữ icon + hàng huy hiệu số giữa phía trên — feature thứ hai{markerId}/badgescủa marker (sm:role: badges, cùng layer marker,sm:seq + 0.5), ảnhsm-badges-{băm}vẽ bằngdart:uitheopixelRatio(viên thuốc trắng + nền màu lùi viền, số căn theo khung nét thật đo ở cỡ ×10, bóng0 1px 3px rgba(0,0,0,.35), lề 4 px). Đáy hàng cách mép trên hộp iconroute.default.stop.badge.iconGapPx(2 px — không đè icon):sm:offsettính sau khi ảnh vẽ xong. Marker được trỏ giữ dáng + hàng huy hiệu; chấm có số được route khác trỏ giữ số của route chủ + huy hiệu của route khác. Màu huy hiệu = màu điểm dừng của route (tourist-route: màu ngày); thứ tựday→ route → số. Kéo marker mang theo hàng huy hiệu. - Icon
urlnhậnshape: "circle"(kUrlIconShapes): cắt vuông phủ kín giữa ảnh, cắt tròn, vòng mảnhrgba(0,0,0,.05); tải lỗi → tròn giữ chỗ#E2E8F0. Một ảnh lỗi không còn làm hỏng cả lệnh (component đó vẽ không icon); Pha B hỏng vì MapLibre vẫnEXEC_FAILED+ hoàn nguyên. - Bấm:
clickcủa marker kèmComponentEvent.stopIn: [(route, n)];ComponentEngine.onMarkerClick(handler)— app nhận cú bấm vào MỌI marker (không cầnevents), trảtrue→ engine không mở popup neo (vd mở panel place). mapContext: routestops: [{ id, n, ref? }], markerstopIn: [{ route, n }]; vượt trần giữ mụcai, rồi route / kế hoạch / popup / marker là điểm dừng, cắt markerappthường (pickContextEntries), giữ thứ tự sổ.kComponentVersions: marker1.2, route1.2. Theme: tokenroute.default.stop.badge(BadgeStyle, thiếu khoá → số đosharemap). Schema / theme nhúng sinh lại từai-map-protocol; ví dụcomponent-route-stop-icon-*,component-route-stop-ref*chép vào fixtures. FacadeSMRoute/SMTripPlanchomarkerRefđi nguyên.- Khoảng lệch: ảnh hàng huy hiệu cần bù tỉ lệ (
sm:isize, Android) nằm ở layer-transformcủa nhóm — có thể khác layer với icon (icon không bù tỉ lệ ở layer gốc); hàng huy hiệu không đè icon nên không thấy khác, chỉ thứ tự chồng so với marker khác cùng nhóm có thể lệch. Feature huy hiệu không tự kéo được (draggable: false) — kéo từ icon, huy hiệu theo.amjson-input.schema.jsoncủa protocol chưa khaistops/stopIn(Fleet đã nhận) — test bỏ đúng hai lỗi đó.
Thêm — component trip-plan 1.0 (ai-map-protocol components doc chương 14, 2026-10-18) #
-
Loại component mới
trip-plan: kế hoạch du lịch sở hữu cáctourist-routelồng trongroutes[](mỗi route mộtday, không trùng; 1–14 route; ≤ 10 kế hoạch mỗi origin) dưới mộttitle— như route sở hữustops[]. Không vẽ gì: engine dựng từng route lồng đúng đường của route rời (màu ngày, chấm có số mỗi ngày từ 1) rồi ghi sổComponentMemory.byPlan+ComponentEntry.planOf;routesOf(planId)sắp theoday. -
Pha A (14.3): route lồng không phải
tourist-route/ thiếuday/ hai route cùngday(hint nêu hai id) /routeslà chuỗi id / rỗng →SCHEMA_INVALIDtrỏroutes[i].…; 15 route hay kế hoạch thứ 11 →PAYLOAD_TOO_LARGE; route lồng khác origin →NAMESPACE_VIOLATION. Route lồng cùng id với route đang có = thay (route rời / route của kế hoạch khác thành route của kế hoạch này; kế hoạch cũ co lại, hết route thì gỡ theo). Sửa riêng một route của kế hoạch:daykiểm trùng với anh em,routeTypekhông đổi được. -
updategửiroutes= thay cả mảng (route rơi khỏi mảng gỡ theo,removedreason: "cascade"); không gửi thì chỉ đổititle/visible/tags/properties.removekế hoạch gỡ mọi route + điểm dừng + marker bám + popup neo (data.cascadedđếm đủ). Gỡ trực tiếp một route của kế hoạch → kế hoạchupdated(changed: ["routes"]), còn 0 route →removedcascade.ai.clearContentgỡ kế hoạch như mọi component. -
Ẩn lan xuống: hiện thật của route =
plan.visible && route.visible, kéo theo điểm dừng, đoạn nối, popup neo; route tự ẩn vẫn ẩn khi kế hoạch hiện lại. -
mapContext.component: mục{ type: "trip-plan", …, title, days, stopCount, distanceKm, durationMin, routes[] }vớiroutes[]là các mục route lồng (theoday); route của kế hoạch không lặp ở cấp trên;count.byTypecótrip-plan; nguồnlabelthêmtrip-plan.title.component.get{ type: "trip-plan", id }trả nguyên kế hoạch kèmroutes[](cóstops), bộ lọctags/visible/bbox(khung bao mọi route) /limit;getroute thêm bộ lọcplanOf.export(id)cùng hình. -
API host (
engine.components):adopt(String id) → Future<bool>— «Chọn kế hoạch»: đổi chủai→appcho component và cả cây nó sở hữu (kế hoạch → route → marker điểm dừng / bám → popup neo), id giữ, mỗi component phátadopted { from: "ai", to: "app", by: "user" }(tổng quát của «Lưu địa điểm» —adoptByUsergiữ nguyên, dùng chung đường);removeByUser(String id) → Future<bool>— «Bỏ kế hoạch»: gỡ mọi origin không qua command,removedreason: "user"cho [id],"cascade"cho phần gỡ theo (tổng quát của nút Xóa trên thẻ —deleteByUsergiữ nguyên).list(ComponentQuery(type: 'trip-plan'))/ComponentQuery(planOf:);count(type: 'trip-plan'). -
ComponentEntry.color(derived.color, 7.4): màu nét đang vẽ của route — màu ngày của theme vớitourist-route, preset /style.line.colorđè lên — đặt khi route được biên dịch (_applyPlans), host tô chấm số của thẻ lộ trình cùng màu tuyến. -
kComponentTypes+=trip-plan; id^(ai|app)-(marker|route|popup|trip-plan)-[0-9]{17}$;kComponentVersionsthêmtrip-plan: "1.0"(mọi gói [1]/[2]/[3] khai thêm);capabilities.componentsliệt kêtrip-plan(ComponentEngine(componentTypes:)mặc định có nó; client không khai →COMMAND_NOT_ALLOWED);kThemedComponentTypes= ba loại có mục theme (trip-plan không cópreset/style). Schema nhúngkAmjsonCommandSchemaJsonsinh lại từ fixture (cóTripPlanAttrs,ComponentVersionscótrip-plan). -
Facade
SMTripPlan(lib/src/components/sm_trip_plan.dart):SMTripPlan(title:, routes:)— route / điểm dừng thiếuidđược cấp id ổn định theo vị trí;setTitle/setRoutes/setVisible/setTags/setProperties;routeIds;onUpdated/onRemoved/onAdopted.buildComponentBatchkhaicomponentVersionscho cả loại lồng (routes[]→route,stops[]→marker). -
PlannedUpsert.isStopđổi tên thànhowned(điểm dừng, route lồng, kế hoạch co lại — không đếm trongdata); thêmcascadeRemoveRoute/cascadeRemovePlan/reconcileTripPlans/detachStopFromRoute(Pha A và đường người dùng dùng chung). Test:test/engine/component/trip_plan_test.dart(30 ca) + ví dụ TP1 / 3 ví dụ sai của spec chép vàotest/fixtures/amjson_examples. -
Thêm command builders có kiểu cho camera, layer, image, query, polygon, buildings, fleet, planned route, tracking markers và history/trajectory. Batch dùng protocol 2.0 và responseTo mới; managed resource ID ổn định theo namespace.
-
Thêm DTO/adapter GPS, lịch sử và
FleetSnapshotTracker; controllerVehicleTrackingControllerquản lý chọn xe, cleanup, reload style, playback, seek, tốc độ và camera follow. Dữ liệu backend POI giữ nguyên quyền hiển thị. -
Engine nội suy
live-vehicle, giới hạn ghi source ở 10Hz với một frame đang ghi mỗi source; source mutation/cleanup chờ frame cũ hoàn thành. -
Luồng đổi style đợi callback style-loaded trước khôi phục tài nguyên.
-
Thêm test tracking, demo Vehicle Tracking và
doc/react-flutter-parity.md. -
Khác biệt native vẫn được ghi rõ: nhãn halo thay 9-slice, history cursor qua MarkerAdapter, chưa terrain/native plugin parity và chưa đo máy thật.
Tracking và example bổ sung (2026-10-16) #
-
Thêm panel chi tiết xe, lịch sử và điểm giao tái sử dụng, controlled callbacks và slots; web example nối chi tiết/kế hoạch/lịch sử và khoảng thời gian.
-
Playback có idle/playing/paused/stopped/ended và tốc độ trong state/tick; stop thực sự đưa về đầu; cập nhật cùng history giữ playhead/tốc độ.
-
Hủy history đang nạp khi clear/replacement/close; pause/stop bỏ camera follow; planned route chỉ fit khi geometry đổi; group state và throttle UI tick.
-
Tổ chức example theo 5 mục menu, tách dữ liệu/command/panel và thêm hướng dẫn đọc.
Thêm — Trả lời hai pha + chat liên tục: message_delta.done, hàng chờ câu hỏi ở MapAgentChatController (ai-map-protocol §9.1.3) #
message_delta { text, done? }: agent phát chữ của model ngay khi có (từng token, hoặc nguyên câu một lần) rồi mới định vị / tính tuyến; mẩu cuốidone: true(có thể rỗng).MapAgentStreamAssemblerkiểmdonelà boolean, bỏ qua mẩu tới saudone, lộmessageDone. Callback đổi kiểu thànhMapAgentMessageDeltaCallback = void Function(String text, {bool done})ởMapAgentTransport.send/MapAgentAdapter.send/MapAgentStreamAssembler(onMessageDelta:);AiShareMapRemote.ask(onMessageDraft:)thànhMapAgentMessageDraftCallback = void Function(String draft, {bool done}). Lớp hiện thựcMapAgentTransportcũ vẫn biên dịch (tham số override rộng hơn); closure(t) => …truyền vào phải thành(t, {done = false}) => ….AiShareMapRemote.ask(requestId:): lớp trên đặtrequestIdcủa lượt trước khi chạy; bỏ trống thì tự sinh bằngnewMapAgentRequestId()(giờ là API public).MapAgentChatController— chat liên tục (song song với hookuseMapAgentChatcủa React): một phiên chỉ chạy một lượt một lúc; câu gửi trong lúc lượt đang chạy xếp vàopendingvà tự gửi tuần tự khi lượt trước kết thúc — xong hay lỗi đều đi tiếp (lỗi lượt trước vẫn ởerrortới khi lượt sau bắt đầu).send(String)giờ đồng bộ, trảMapAgentSendReceipt? { id, queued, settled }(nullkhi câu rỗng / chưaattach):id=requestIdcủa lượt (=MapAgentTurn.requestId),settledhoàn tất khi lượt của câu đó kết thúc hoặc câu bị rút. Code cũawait chat.send(x)→await chat.send(x)?.settled. Quyết định chạy-ngay / xếp hàng dựa trên field thường bật đồng bộ, nên haisendtrong cùng microtask không chạy chồng.pending(danh sáchMapAgentPrompt { id, text }không sửa được),cancelPending(id),current(câu đang chạy,nullkhi rảnh),busy=isThinking || pending.isNotEmpty;isThinkinggiữ nghĩa cũ. Bong bóng người dùng vàomessageslúc thật sự gửi (khicurrentđổi), không phải lúc xếp hàng.reset()/dispose()bỏ hàng chờ;cancel()chỉ huỷ lượt đang chạy.draft=MapAgentDraft { requestId, text, done }của lượt đang chạy (nullkhi rảnh);draftMessagegiữ làm bí danh củadraft?.text. UI dựng block câu trả lời tạidone, cập nhật cùng block khiaiMessagechuẩn củabatch_endvàomessages.
Thêm — AiShareMapRemote(mapLinks: true): chip địa điểm giữa chữ của aiMessage (spec §5.1.2) #
- Khai
capabilities.mapLinks→ agent gắn[tên](sharemap:cite/<n>)vào tên địa điểm có trongcitations. Mặc địnhfalse(app hiện chữ thuần không thấy cú pháp lạ).EngineCapabilities.toJson(mapLinks:),buildMapAgentInput(mapLinks:).
BREAKING — Route 1.1 / marker 1.1: tourist-route + day, điểm dừng là chấm có số (components doc 6.2, 7.2–7.4, R2–R8) #
routeType: "tourist-route"+day(1–99): tuyến một ngày của lịch trình — vẽ nhưbasic, màuroute.touristRoute.dayColors[(day − 1) % n]thayline.colorở tầng mặc định (ComponentTheme.routeStyleOf): preset cóline.colorđè màu ngày,style.line.colorđè cuối.daybắt buộc vớitourist-route, loại khác gửiday→SCHEMA_INVALID(kiểm sau gộp; đổi sang loại khác thìdaybị bỏ).mapContextroute mangday.SMRoute(day:),day,setDay().- Điểm dừng của mọi loại route = chấm tròn có số (không còn ghim sprite): icon
{ color }, hìnhmarker.dot.numbered(Ø 24, viềnmarker.dot.border, số trắng đậm 700 — 0.55 / 0.46 × Ø), neocenter, nhãn dưới chấm (sm:toffset[0, 1.2]). Số do engine điền; màu mặc định:tourist-route→ màu tuyến cuối cùng, loại khác →route.stop.color(#3AA3FF). Điểm dừng chỉ nhận{ color }— ghim sprite / emoji / url / template /pinText→SCHEMA_INVALID. Ảnh khoásm-dotnum-{màu}-{cỡ}-{viền}-{chữ}-{màu chữ}(dotNumberImageId,DotImage(text:, textColor:)).mapContextkhông cònicon: "pin-blue"cho điểm dừng. stopConnectors(mặc địnhtrue): điểm dừng đang hiện cách hình học đang vẽ (alternatives: phương án đang chọn) ≥ 5 m → đoạn nối[điểm gần nhất, điểm dừng](nearestOnLine), featuresm:role: "connector",sm:fid{id}/connector/{i}, màu = màu tuyến tại điểm đó (progress: done / remaining;alternatives: selected). Layer mớism-route-{grp}-connectordưới casing: chấm tròn —line-dasharray/ rộng / đục là hằng từ tokenroute.connector(khoá bắt buộc của theme gốc), đầu tròn, không nhận bấm, không sự kiện, khôngmapContext. Điểm dừng dời / ẩn / gỡ → route dựng lại đoạn nối;false→ không vẽ.- Marker
{ color, pinText?, pinTextColor? }: chấm có số cho marker rời (SMIcon.color(…, pinText:)). - Popup
anchorTomột chấm: khoảng tự tính theo hộp chấm gồm viền (chấm 16 → 10, chấm có số → 14) — kể cả khi ảnh chưa vẽ xong. - Theme:
route.default.stop+touristRoute.dayColorslà khoá bắt buộc của theme gốc;marker.default.dot.numbered.kComponentVersionsmarker / route →1.1. Fixtures schema (command · input · style · theme),themes/sharemap.json, ví dụ route / mentions / cases / toolgroups đồng bộ; bản nhúng sinh lại. Demo: tuyến ngày 2 + điểm lịch trình là chấm có số; điểm dừng giao hàng đổi sang{ color }.
Sửa — marker.border.radius số tối đa 64 #
Pha A nay loại border.radius dạng số > 64 (SCHEMA_INVALID), khớp MarkerBorder của schema command và style doc;
"circle" giữ nguyên. Schema command nhúng sinh lại; ví dụ component-route-stop-number-start.json đồng bộ.
Thêm — popup.shareButton, thẻ điểm dừng chỉ còn ✕, "Lưu địa điểm" chuyển chỗ AI cho người dùng (components doc 4.4, 5.3, 8.2, 8.3) #
shareButton(mặc địnhfalse, chỉ vớicontent— cùngtemplate→SCHEMA_INVALID, kiểm sau gộp):PopupShareButton(icon chia sẻ 13 vẽ đúng SVG thiết kế, hover như ✕) trong nhóm nút góc phải thùng rác · chia sẻ · ✕ (gap 8, một khối — nút tắt thì dồn về phải); bấm phátactionactionId: "share". Tokenpopup.default.share— khoá bắt buộc của theme gốc;darkcóshare. Tên đọc "Chia sẻ" / "Share".- Thẻ điểm dừng: popup
anchorTomột ghim điểm dừng route chỉ dựng ✕ — không hàng nút, không xóa, không chia sẻ (cấu hình giữ nguyên; đổi neo sang marker thường thì hiện lại). - Adopt: bấm
add-placetrên popup có origin hiện tạiai→ComponentEngine.adoptByUser: popup + marker nó neo đổi originai→apptrong sổ (id giữ),add-placebị bỏ khỏicontent.actions, phát sự kiện vòng đờiadopted{from: "ai", to: "app", by: "user"}cho cả hai (ComponentEvent.from/.to); không phátactionadd-place. Popupappbấmadd-placevẫn chỉ phátaction. Thẻ giữ bề rộng đang có tới khi đóng (khoá chung với hàng xác nhận xóa — hai khoá một bề rộng, hết cả hai mới nhả). - Namespace theo origin hiện tại: component đang có kiểm
origincủa command với origin trong sổ, tạo mới theo tiền tố id —update/remove/gettheo id,anchorTo,along.routeId, điểm dừng, bộ lọcstopOf/alongOf.ai.clearContentvàmapContext(origin) dùng origin hiện tại. - Facade:
SMPopup(shareButton:),shareButton,setShareButton(),onAdopted;SMMarker.onAdopted;SMComponentBase.originđổi theoadopted(lệnh sau đi bằngapp),SMPopupbỏadd-placekhỏistate. - Fixtures schema command / style,
themes/sharemap.json, mentions, cases đồng bộ; bản nhúng sinh lại. Demo: nút chia sẻ trên thẻ lịch trình, "Chỗ AI gợi ý" lưu được.
Thêm — popup.deleteButton: người dùng xóa chỗ này khỏi bản đồ (components doc 8.2, 8.3) #
deleteButton(mặc địnhfalse, chỉ vớicontent— cùngtemplate→SCHEMA_INVALID, kiểm sau gộp): thùng rácPopupDeleteButtonngay trái ✕ (gap 8, cùng cách căn dòng chữ đầu) trên thẻlocationvàtourist-point; popup neo điểm dừng route không dựng nút. Tokenpopup.default.delete(sizePx16 ·iconSizePx13 ·color·hoverColorđỏ) vàbutton.danger— khoá bắt buộc của theme gốc; presetdarkcódelete.- Bấm → hàng xác nhận
PopupDeleteConfirmthay hàng nút (câu hỏi 12/600 + gợi ý 11, Hủysecondarynhận focus · Xóadanger+ thùng rác); Hủy trở lại; đóng thẻ khi đang xác nhận = hủy. Thẻlocation(tự giãn theo hàng nút) giữ bề rộng lúc mở hàng xác nhận làm bề rộng tối thiểu tới khi hủy — không co lại. Chữ theouiLocale("Xóa địa điểm này khỏi bản đồ?" / "Remove this place from the map?", Hủy · Xóa / Cancel · Remove, tên nút "Xóa địa điểm" / "Remove place"). - Xóa →
ComponentEngine.deleteByUser(popupId)(thao tác người dùng, mọi origin): popupanchorTo→ gỡ marker (removedreason: "user") + popup ("cascade"); không neo → gỡ riêng popup ("user"). SMPopup(deleteButton:),deleteButton,setDeleteButton(). Fixtures schema command / style,themes/sharemap.json, ví dụ (component-popup-delete-template.json, tourist-point, mentions, cases) đồng bộ; bản nhúng sinh lại. Demo: thẻ lịch trình có nút xóa.
Thêm — popup.openOnAnchorClick + luật một marker — một popup (components doc 8.2, 10.8, 10.12) #
openOnAnchorClick(mặc địnhtrue, chỉ tác dụng khi cóanchorTo;nullkhiupdate= mặc định): người dùng bấm marker (kể cả ghim điểm dừng route) mà popup neo vào nó đang đóng →state.open = true, hiện overlay, phátopenby: "user"; đang mở thì giữ nguyên — cú bấm đó không bịcloseOnClickđóng lại. Không cần marker khaievents; marker khaiclickthì app vẫn nhậnclick. Áp cho popup mọi origin.false= app tự xử lý cú bấm.SMPopup(openOnAnchorClick:),openOnAnchorClick,setOpenOnAnchorClick().- Một marker — một popup: Pha A kiểm trên sổ sau action (dời neo trong cùng action hợp lệ); popup thứ hai neo
vào marker đã có popup →
COMPONENT_DEPENDENCY_CONFLICT,repair.available/hintnêu popup đang neo.ComponentMemory.byAnchornay một-một (Map<markerId, popupId>), thêmpopupOf(markerId). mapContext.component.items[]của popup:popupTypeluôn có với popupcontent(locationkhi chưa khai), không có với popup template (mangtemplate);anchorTo= marker đang neo, chỉ khi có — cả hai vàocontextHash(components doc 11). Fixtureamjson-input.schema.jsonđồng bộ.- Schema command nhúng sinh lại; fixtures
component-popup-tourist-point-update.json,cases/mentions-lich-trinh.jsonđồng bộ.
Sửa — thẻ popup có content.category: nút ✕ bị đẩy xuống dòng tiêu đề #
category (khối mở rộng) nay nằm trong hàng tiêu đề (components doc 8.3 "Hàng tiêu đề"): cột chữ = category
(11/600, chữ hoa, giãn 0.04 em, line-height 14, màu subtitle.color) cách hàng title + rating 2 px; hàng căn
trên. Nút ✕ luôn ở góc phải trên, căn giữa theo dòng chữ đầu — dòng category khi có (lệch −1), không thì dòng
title (+1.6) — PopupCloseButton(lineHeight:). Thẻ tourist-point cùng luật (✕ ngang dòng nhãn). image vẫn trên
cùng thẻ. Fixtures mentions-*.json đồng bộ lại (nay có "popupType": "location").
Thêm — Popup 1.1: popupType: "tourist-point" + content.extra.visit #
Thẻ điểm tham quan trong lịch trình (ai-map-protocol themes/components/popup.md 8.2, 8.3 "Giao diện
tourist-point", 8.5 P7) — đúng Popup 3 của sharemap-ai-design-component/sharemap-popup, cùng thang với thẻ
location (cùng khung, cỡ chữ, mũi tên 16 × 8, hàng nút): nhãn, tiêu đề xuống dòng, hàng lịch ghé thăm (ô ngày · ô
buổi + khoảng giờ), ghi chú, đường kẻ, "Trên bản đồ" + địa chỉ, hàng nút chung.
popupType(locationmặc định ·tourist-point), tập đóng — tên lạ →SCHEMA_INVALID; chỉ đi vớicontent(cùngtemplate/data→SCHEMA_INVALID);"location"không lưu vào cấu hình,nullkhiupdate= vềlocation.tourist-pointchỉ nhậncategory·title·subtitle(bắt buộc — địa chỉ) ·extra·actions.content.extra.visit{ day, period, startTime, endTime }—extratập khoá đóng, chỉ ởtourist-point;daysố 1–99 hoặc chuỗi 1–40;period∈ morning · noon · afternoon · evening · night · allday;startTimecầnperiod,endTime(tuỳ chọn) cầnstartTimevà sau nó trong cùng ngày. Hợp loại kiểm trên cấu hình sau khi gộp (contentkhông gộp sâu). Popup mẫu (TemplatePopup) khaicontent.extra→SCHEMA_INVALID.extra.visit.note(chuỗi 1–300, chữ thuần) — hàng ghi chú (TouristPointIcon.note=tp-note14 px cách chữ 6, tokentouristPoint.visitNote12/400 +iconColor, line-height 16) ngay dưới hàng lịch, cách gap thẻ − 4 (6); không có hàng lịch (khôngdaylẫnperiod) thì đứng một mình, giữ gap thường (10). Đường kẻ khi có hàng lịch hoặc hàng ghi chú.visitNotelà token bắt buộc của theme gốc.content.subtitlenới 120 → 300 ký tự cho mọipopupType.- Renderer
TouristPointView(component_popup_layer.dart): rộng cố địnhtouristPoint.card.widthPx(300 ≈ thẻlocationba nút; padding 12, gap 10), kẹp ở bề rộng bản đồ − 32 vàmaxWidthPxsố; bị kẹp dướiwidthPxthì chỉ hàng lịch xếp một cột (mọi cỡ khác giữ nguyên). Header cách cột 8, nhãn 11/600 line-height 14 giãn 0.04 em cách tiêu đề 2, tiêu đề 16/700 line-height 1.2; ô lịch cao 40, bo 8, padding0 10, icon 18 cách chữ 8, hai ô cách 6; địa chỉ ghim 16 cách chữ 8, nhãn 11/500 cách địa chỉ 12/400 (line-height 16) 2; nút ✕ hộp 16 nhưlocation. Khôngdaylẫnperiod→ ẩn hàng lịch; một ô thì chiếm cả hàng; mặt trời cho morning · noon · afternoon · allday, mặt trăng + màuvisitPeriod.mooncho evening · night; icon vẽ đúng path SVGtp-calendar·tp-sun·tp-moon·tp-note·tp-pin(parseSvgPathDatanay đọc cả lệnh cungA). Thẻ + mũi tên (touristPoint.anchorIcon8 → 16 × 8) vẫn mộtPath. Hàng lịch đọc thành một câu cho trình đọc màn hình. - Theme: nhóm
popup.default.touristPoint(TouristPointLook) là khoá bắt buộc của theme gốc; presetdarkcó bản tối. Bản nhúngthemes/sharemap.jsonvà schema command / style / theme sinh lại. uiLocale— tuỳ chọn khởi tạo (ComponentEngine(uiLocale:),ShareMapLibre(uiLocale:), mặc địnhvi;vi·en,en-US→en, ngôn ngữ khác lùi vềvi) cho chữ engine tự sinh: "Ngày 2" / "Day 2", Sáng · Trưa · Chiều · Tối · Đêm · Cả ngày, "Trên bản đồ", nhãn mặc định "ĐIỂM THAM QUAN" / "ATTRACTION", tên nút đóng cho trình đọc màn hình "Đóng" / "Close" (mọi thẻ popup). Không đi trên dây; chữ AI viết thắng.PopupUiText(component_ui_text.dart),engine.uiText. Nút của thẻ (✕, hàng nút) nay là nút trợ năng riêng (Semantics.container), không gộp tên vào chữ bên cạnh.popupTypekhácnull(kể cả"location") cùngtemplate→SCHEMA_INVALID, kiểm trên cấu hình sau khi gộp (update"popupType": "location"lên popup template cũng bị loại);"popupType": nullcùngtemplatehợp lệ.SMPopup(popupType:),popupType,setPopupType(type, content:).kComponentVersions.popup→1.1.- Demo
example_web(Components): hai điểm lịch trình (sáng — mặt trời, tối — mặt trăng) + đổi lịch.
Bỏ — client.locale trong gói [1] (ai-map-protocol §3.7) #
MapAgentClientInfo không còn locale (trước lấy từ PlatformDispatcher.locale); MapAgentClientInfo.current() bỏ
tham số locale. Ngôn ngữ trả lời theo câu người dùng gõ — ngôn ngữ máy từng làm agent trả câu runtime sai thứ tiếng.
Fixtures protocol (schema, ví dụ input / turns / cases, vector wire input) đồng bộ lại.
Sửa — Map Agent qua SSE: lượt có marker/popup bị từ chối vì rơi componentVersions #
Bộ ghép [2] từ stream (lib/src/agent/remote/map_agent_stream.dart) không chép componentVersions từ khung batch_start, nên validator của engine từ
chối mọi lượt có action component.* (SCHEMA_INVALID — "componentVersions is required…"): AI trả lời nhưng bản
đồ không vẽ gì, camera không bay, chip citation trong chat bấm không có gì. Nay chép ngay sau version (components
doc 5.6, spec §9.1.3). Ví dụ stream progress-session-citations đồng bộ lại từ ai-map-protocol (bản cũ không có
action component nên test không bắt được) + test riêng.
Thêm — mapContext.camera.corners: bốn góc vùng người dùng đang thấy #
buildMapContext() chiếu bốn góc viewport (controller.toLatLng, cả bốn một lượt) ra [lng, lat] — trên-trái,
trên-phải, dưới-phải, dưới-trái, 5 chữ số — đặt ngay sau bounds. Toạ độ màn hình theo đơn vị của nền tảng (Android:
pixel vật lý; iOS / web: pixel logic), như ComponentPopupLayer. Bản đồ xoay / nghiêng thì vùng thấy là tứ giác hẹp
hơn bounds; không chiếu được thì bỏ. Hàm visibleCorners (map_context_digest.dart).
Thêm — Vị trí người dùng: locateUser (mặc định bật) + mapContext.userLocation #
Bản đồ lấy vị trí thiết bị để AI hiểu "gần tôi", "từ chỗ tôi" (ai-map-protocol sharemap-engine.md 12d,
sharemap-context.md 4.1a). ShareMapLibre(locateUser: false) tắt hẳn: không hỏi quyền, không định vị, mapContext
không có userLocation. locateUserOptions: LocateUserOptions(prompt, showDot, showButton, highAccuracy, labels).
- Dependency mới
geolocator(kiểm / xin quyền, mở cài đặt, stream vị trí — Android, iOS, web). App phải khai quyền: iOSNSLocationWhenInUseUsageDescription, AndroidACCESS_FINE_LOCATION/ACCESS_COARSE_LOCATION. - Kiểm quyền trước: đã cho phép → theo dõi ngay (
distanceFilter10 m); hỏi được → thẻ xin quyền (Cho phép gọi hộp thoại hệ thống, Để sau); bị chặn → thẻ với Mở cài đặt (web: hướng dẫn ổ khoá + Thử lại); tắt dịch vụ vị trí → thẻ Bật vị trí. Quay lại app (AppLifecycleState.resumed) hoặc bật lại dịch vụ thì tự kiểm lại. Thẻ theo thiết kế sharemap-popup (PopupLook,PopupActionButton), rộng 320, giữa đáy bản đồ;Escape= Để sau. - Chấm vị trí = puck của MapLibre (
myLocationEnabled), chỉ bật khi đã có quyền — bật sớm thì iOS tự hỏi, vượt mặt thẻ của engine. Nút "Vị trí của tôi" bay tới hoặc xin quyền lại. - Có vị trí lần đầu thì camera bay tới (zoom ≥ 16, một lần mỗi bản đồ) — trừ khi camera đã rời
initialCameraPosition(người dùng kéo, AI / app ra lệnh camera): không giật khung nhìn.flyTo: falsetắt. Bấm nút vị trí lúc chưa có vị trí thì có là bay, bất kể camera. mapContext.userLocationngay saucamera:statusok(lngLat5 chữ số,accuracyM,at,headingkhi đang đi,speedMps) ·locating·prompt·denied·unavailable. Không vàocontextHash; góiomittedvẫn mang.- API:
engine.userLocation,engine.userLocationTracker(ChangeNotifier),engine.requestUserLocation();ShareMapEngineOptions.userLocation;ShareMapLibre.userLocationPlatformthaygeolocatorkhi test. Modulelib/src/engine/user_location/, widgetlib/src/widgets/user_location_overlay.dart.
Thêm — popup.anchorTo: popup neo vào marker #
Popup khai anchorTo: "<id marker>" thay cho lngLat (components doc 8.2): đứng ở vị trí marker đang vẽ và đi theo
khi marker dời — update, người dùng kéo (dính theo ngón tay từng bước drag), placeOnClick, marker along khi
route đổi tiến độ / chạy transition. Không khai offsetPx thì engine đo hộp icon marker đang vẽ (ảnh engine vẽ hoặc
ảnh sprite × scale, theo anchor / offsetPx của marker) và đặt khoảng mũi tên theo từng phía
(PopupOverlaySpec.offsetSides, markerIconExtents, popupAnchorPlacement nhận PopupOffsetSides). Marker ẩn → popup
ẩn; remove marker (hay route mang marker) gỡ dây chuyền popup (reason: "cascade"). Có lngLat thì lngLat thắng về
vị trí. ComponentMemory.popupsOf(markerId); SMPopup(anchorTo:) nhận id hoặc SMMarker, setAnchorTo(),
setLngLat(null). Schema command nhúng sinh lại.
BREAKING — Popup theo thiết kế sharemap-popup, style theme tách theo phần #
Thẻ popup mặc định (ComponentPopupLayer) dựng lại đúng thiết kế
sharemap-ai-design-component/sharemap-popup (components doc 8.3): hàng tiêu đề (title một
dòng + ★ rating + (ratingCount) + nút ✕), subtitle, description (has-description: padding
12, gap 10), hàng nút .buttons-N (primary / secondary, hover / active, icon SVG của thiết
kế). Thẻ + mũi tên neo vẽ thành một Path (PopupCardPainter): mũi tên cùng nền thẻ, bóng
card.shadow phủ cả hai. Số đo khớp thiết kế (thẻ 3 nút 303.6 × 107 px với font Inter).
- Theme
popup: bỏ token phẳngbackground/foreground/muted/accent/radiusPx/shadow; thay bằng phầncard(+hasDescription) ·title·rating·subtitle·description·close·button(primary/secondary) ·anchorIcon.PopupOverlaySpec.lookmang các phần này; đọc quaPopupLook.of. PopupOverlaySpec.maxWidthPxthànhdouble?—null="none"(mặc địnhsharemap: tự giãn); thẻ luôn kẹp ở bề rộng bản đồ − 32, title cắt….SMPopup(maxWidthPx:)nhận số hoặc'none'.offsetPx= khoảng từ điểm tới đỉnh mũi tên, mặc định themesharemapđổi 25 → 16 (vừa emoji / icon 32 px neo giữa; ghim sprite 40 × 48 thì khaioffsetPx: 48); hướng góc dời ngang14 + sđể mũi tên thẳng điểm.anchor: autochọn phía nhưmaplibregl.Popup(theo kích thước thẻ đo được).PopupContentthêmdescription(≤ 300),ratingCount; icon nút thêmadd-place.- App cần khai font
Inter(pubspec) để khớp số đo; thiếu thì lùi về font hệ thống.
BREAKING — AI Map Protocol 2.0.0, phase 1 (protocol base) #
Spec: ai-map-protocol 2.0.0 (§3 Input, §5 Command, §7 Result; sharemap-context.md
§4–§6). Phase 2 — the component target (marker / route / popup engine and the
SMMarker / SMRoute / SMPopup facades) — is the next section; it plugs into the
seam below.
kProtocolVersion=2.0.0. A[2]with another major is rejectedVERSION_MISMATCH;roundandaiMessageare now required on network batches;contextResyncandoriginare accepted envelope fields.- Whitelist 13 → 25 commands (§5.2): adds
camera.easeTo,source.addVectorTiles(host allowlistShareMapEngineOptions.allowedTileHosts),source.patch(+transition),layer.setInteraction,feature.setState/clearState,image.add/remove, andcomponent.add/update/get/remove.source.addOrUpdategainscircle,datasetandoptions(cluster,lineMetrics,tolerance,promoteId);layer.addgainsfill-extrusion,interaction,animation,progress,iconTemplate;marker.addFromSourcetakes the 2.0.0 shape (popuptemplate popup,events,color— the 0.0.xpopupProperty/emoji/iconUrlpayload fields are gone). - The Command Validator checks payloads with the spec's own schema
(
amjson-command.schema.json, embedded askAmjsonCommandSchemaJson, validated by the newJsonSchemaValidator), plus the rules the schema cannot express: id format{origin}-{kind}-{17 digits}withkindfrom the closed set — strict, like the web engine: free-form ids such asai-coffee-shopsareSCHEMA_INVALIDwithpathalthough the schema'sManagedIdstill lets them through —, layer ids{sourceId}-{role}(role^[a-z][a-z0-9-]{0,23}$, no exception),originnamespaces (NAMESPACE_VIOLATION), tile/icon hosts, registered templates (TEMPLATE_NOT_FOUND) and datasets,progress/animationcross-rules, expression depth, size caps (PAYLOAD_TOO_LARGEwithrepair.limit/actual). Every error carriespath(JSON Pointer) andrepair.validateAction(action, ValidationContext(...))replaces the named-argument form. - Pha A (
sharemap-engine.md§3.1): the engine pre-checks the whole batch — whitelist,capabilities.commands, namespace, schema, caps, in-batch dependencies (layer.add/marker.addFromSource/source.patchon a source nothing creates →SOURCE_NOT_FOUND,missing-dependency), image cap per origin,lineMetricsforprogress,sourceLayeron vector sources. Any failure ⇒status: "rejected", failing actionserror, the restskipped, no map call. NewShareMapEngine.precheck(batch)runs it as a dry run. origin(§5.1.1).JsonCommandBatch.origin(missing =app) andwithOrigin().ShareMapEngine.executeAiBatch()is the single place every AI path goes through and overwritesorigin: ai—AiShareMapRemoteand every local agent tool now use it; a packet that claimsappthrough an AI path is rejected. App code callingexecuteBatchwithoutoriginworks onapp-ids;ai.clearContentonly clears the namespace of the batch's origin (clearContent(origin);clearAiContent()kept).- Error registry 14 → 18 (
TEMPLATE_NOT_FOUND,ICON_NOT_FOUND,COMPONENT_NOT_FOUND,COMPONENT_DEPENDENCY_CONFLICT). JsonResult.statusis required;[3]always carriesstatusandmapContext.JsonResult.versionis now the client's protocol version, not an echo of[2].mapContext2.0.0 (sharemap-context.md§4), emitted directly by the engine —toProtocolMapContext()andincludeBasemapLayersare gone. Groupscamera(+sizePx,limitsfromminMaxZoomPreference/cameraTargetBounds),component(from the component handler, empty without one),source(every style source butsm-*, real type from the loaded style JSON /getStyle(),origin,featureCount/dataHashfor engine GeoJSON,live,dataset,clustered,markers {count, popupProperty}),layer(onlyai/appandaiEditablebasemap layers +basemapLayerCount;hasFilter,interactive,selectable,animated,progress),image.count,digest(L2 from per-layerqueryRenderedFeaturesInRect: dedupe by id, clusterpoint_count, bbox, property whitelist, ≤ 3 samples,selected) andmeta(builtAt,settled,inventory,contextHash= first 16 hex of SHA-256 over the canonical inventory without componentprogressand live-source hashes,lastBatchId,selections,lastInteraction). Nomarker,ai,aiManaged,popup,terrain.MapContext.aiDigeststays as a convenience for local tools (filtersorigin: ai).[1]Input 2.0.0 (buildMapAgentInput):payload.prompt(notype, nosanitizedPrompt),capabilitiesfromengine.capabilities(EngineCapabilities: only commands the engine really runs — nofeature.*on iOS/Android,component.*andcomponentsonly with a handler — plusallowedTileHosts,templates,datasets,icons,limits).supportedMapAgentCommands(engine)takes the engine.AiShareMapRemotedropsincludeBasemapLayers/allowedTileHosts(the engine owns tile hosts).- Delta context (§3.5): new
MapContextDelta.AiShareMapRemotesendsmeta.inventory: "omitted"(four inventory groups dropped) when the hash equals the last hash sent in the session, andfullon the first turn of a session, when the agent returns asession.iddifferent from the one the client holds, orhistoryMessages: 0for the session the client already held (the first[2]of a brand-new session legitimately says0and forces nothing), whenever the hash changed, and in the[3]that answerscontextResync: true(sameround,results: [], no action run). The flag is read from REST bodies and from SSEbatch_start. - Component seam (phase 2):
ComponentHandler(lib/src/engine/component_handler.dart)ShareMapEngine.registerComponentHandler(). The engine routescomponent.*to the handler'sprecheck(Pha A, whole batch) andapply(one call per run of consecutive component actions),clear(origin)forai.clearContent, andinventory()formapContext.component. Without a handlercomponent.*stays in the whitelist but is not advertised and is rejectedCOMMAND_NOT_ALLOWED(command-not-in-capabilities) — never silently dropped.
- New public API:
managed_id.dart(generateEntityId,stableEntityId,parseManagedId,parseLayerId,layerIdFor),ShareMapDataset/registerDataset,ShareMapTemplate/registerTemplate,ShareMapIcon/setIcons,markSourceLive,handleFeatureTap/handleMarkerTap,ShareMapEngineOptions.{allowedTileHosts, propertyWhitelist, styleJson, cameraLimits, featureStateSupported, reducedMotion, onInteraction, onTemplatePopup, httpClient}andcopyWith. - Local agent tools generate 2.0.0 ids (
aiToolSourceId/aiKeyedSourceId, same slots as the webtoolIds.ts) and the newmarker.addFromSourcepayload. sharemapSdkVersion/ package version1.2.0.
AMJSON Components 2.0.0 — the component target (phase 2) #
Spec: ai-map-protocol/sharemap-amjson-components.md (chapters 3–12), port of the web
engine sharemap-maplib-reactjs/src/lib/engine/component/.
ComponentEngine(lib/src/engine/component/) implementsComponentHandler;ShareMapLibreregisters it with every engine it builds, socapabilities.components(marker,popup,route),component.add/update/get/removeand the 13 built-in pins (capabilities.icons, after the app's sprite icons) are advertised by default. Headless engines callengine.registerComponentHandler(ComponentEngine()).- Pha A on a draft Component Memory for every component action of the batch (an
ai.clearContentin between is simulated): identity (typeoutsidecapabilities.components→COMMAND_NOT_ALLOWEDon/type, id format, kind ↔type, origin →NAMESPACE_VIOLATION, "one id, one resource" againstsourceIds both ways), shape of every attribute (no unknown fields, no clamping,null= back to default inupdate), merge (styledeep, objects / arrays replaced,lngLat↔along,content↔template, a route type change drops old-type state and style overrides, new geometry re-selects option 0), then on the merged config:along.routeId(same origin,COMPONENT_NOT_FOUND+missing-dependency; order insideitemsirrelevant, later actions not visible),"{progress}"needs a progress route, wrong-type attributes,COMPONENT_DEPENDENCY_CONFLICT, stops (full markers,lngLat, noalong/ drag, same origin, unique ids), templates (TEMPLATE_NOT_FOUND+repair.available, wrong kind →SCHEMA_INVALID,datachecked againstdataSchemawith the exact path,image-urlfields outsideallowedIconHostsdropped then re-checked),ICON_NOT_FOUND+available, caps checked on the Component Memory after the action (200 / 50 / 50 per origin, 10 open popups, oneplaceOnClickper origin, 10 000 vertices…). Errors carrypath(JSON Pointer),repairanddata.errors(≤ 10 rows; beyond that rows with the same code- path tail are grouped with
count;errorCount= total).
- path tail are grouped with
- Component Memory — the indexed component store (id / type / origin / tag / owner),
class
ComponentMemoryincomponent_memory.dart, exposed asComponentEngine.memory; the 10.12 API onComponentEngine:get,count,list(ComponentQuery),fromFeature,export,events/on(listener). - Compile → fixed resources: features on
sm-points/sm-lines(+sm-polygonsreserved,sm-anim-points/sm-anim-lines) carryingsm:*properties (only values that differ from the layer defaults), layerssm-marker-{grp}/sm-route-{grp}-{casing|dash|line|label}per group key (zIndex / zoom range / alignment) inserted with the C3belowLayerId, never moved, empty groups removed; built lazily on the first component action, rebuilt after a style reload. OnesetGeoJsonSourceper changed source per run of consecutive component actions; no-op actions →skippedByDiff. Pha B failure (e.g. an image that cannot be drawn) →EXEC_FAILED, sources restored, Component Memory untouched. - Images keyed by content (
sm-emoji-…,sm-pin-…,sm-url-…,sm-{pin},sm-tpl-…,-b…for borders), drawn withdart:ui(UiComponentRasterizer: built-in pins drawn as paths, emoji,https/data:URLs through the engine HTTP client,ShareMapTemplate.renderImagefor marker templates, borders), reference counted, all drawn before any source write. - Routes:
basic;progresscut into done / rest geometries (noline-gradient), markers along"{progress}"on the same cut;alternatives(selected option on top; tapping another option selects it →selectbyuser;update→selectbybatch);transitioninterpolatesprogresson thesm-anim-*copies (~60 fps timer, line and markers in the same frame,updatedwithchanged: ['progress']at the end; instant withreducedMotion); stops are full markers owned by the route (cascade on remove, list replaced onstops, a stop removed alone leavesstops). get→{count, missing, truncated, items: [{component, state}]}, read where the action sits in the batch; AI reads only its own components, app reads both.ai.clearContentremoves the origin's components (removed,reason: clear); so do the host callsShareMapEngine.clearAiContent()and the newclearAppContent().ComponentEngine.setOpen(id, open)(spec §8.3, §10.12): the host opens / closes a popup of any origin on the user's behalf (not an AMJSON command — no namespace check). Changes onlystate.open, emitsopen/closewithby: "user", returnsfalsefor an id that is not a popup; avisible: falsepopup remembers it without showing; the owner's nextupdatewithopenre-applies the config.- Chat helpers for place mentions (spec §5.7,
amjson-mentions.md):readItinerary(engine)reads the itinerary from the Component Memory (markers taggedplan,aibeforeapp, else the route with most stops), andresolveCitation(engine, citation)/popupPairs(citations)turncitations[].componentIdsinto a fly-to target + the paired popup to open. - Events (
click,hover,contextmenu,dragstart,dragend,placed,select,open,close,action— only when declared inevents;added/updated/removedalways) go toComponentEngine.on; user interactions are recorded intometa.lastInteraction(lngLatonly for click / dragend / placed). mapContext.component: counts by origin / type; items withlabel(marker label / routemetadata.label/ popupcontent.title, cut to 60), no coordinates / properties / popup content; 600 items thentruncated; routeprogressstays out ofcontextHash.- Popups are a Flutter widget overlay (
ComponentPopupLayer, placed byShareMapLibrein aStackabove the map): positions from one batchedtoScreenLocationBatchper camera change (in-flight calls coalesced;trackCameraPositionis switched on only while a popup is shown),anchor(includingauto),offsetPx,maxWidthPx ≤ 480, close button,closeOnClick(a popup opened while handling a click survives that click),closeOnMove, zoom range;PopupContentrendered as plainText(never HTML) with action buttons; templates throughShareMapTemplate.popupBuilder(context, data, ctx)(ctx.emitlimited to the template'sactions,ctx.close). The phase-1 template popups oflayer.add.interaction.popup/marker.addFromSource.popupopen in the same overlay when the app does not setonTemplatePopup. - Facades
SMMarker,SMRoute,SMPopup(+SMIcon,SMComponentError):attach(engine)=component.add, mutations sendcomponent.updatewith only the changed keys,remove();positionis an alias oflngLat;SMRoute.setProgress(p, durationMs:),selectOption,setStops(stable ids per position),fitBounds;SMPopup.open/close/setContent/setTemplate; listeners (onClick,onDragEnd,onSelect,onAction, …) declare their interaction event to the engine. Commands go through the newShareMapEngine.executeBatchQueued(serial, never superseded). ShareMapTemplategainspopupBuilder/renderImage; its capabilitydatadropsformat: "image-url"fields. Seam additions:ComponentHost.{sourceIdExists, icons, templates, isIconUrlAllowed, reducedMotion, fetchImageBytes, recordMapCall},ComponentHandler.{hasComponent, builtinIcons, showTemplatePopup},ComponentActionRef.isClear.- Demo:
example_web→ "AMJSON Components". - User overlay on
config(spec §5.5) — user interactions write onlystate, neverconfig, and the write lands before the event fires:- Popup inputs:
PopupContent.inputs[](≤ 8;textwith requiredmaxLength1–300 and optionalplaceholder,numberwithmin/max,selectwith 1–20options,toggle; initialvaluechecked against the kind) validated in Pha A with exact paths; template popups (layer.add/layer.setInteractioninteraction.popup,marker.addFromSource.popup) declaringcontent.inputs→SCHEMA_INVALIDon…/popup/content/inputs. The overlay renders text / number fields, a dropdown and a switch, and commits on Enter / blur / selection / toggle (not per keystroke; out-of-range numbers do not commit). A commit that differs from the effective value writesstate.input[name]then emitsinput(name,value) — implicit, declaring"input"ineventsisSCHEMA_INVALID; equal value → silent;state.inputcapped at 2 KB. Templates declareShareMapTemplate.inputs(ShareMapTemplateInput, published incapabilities.templates[].inputs, checked atregisterTemplate) and commit withctx.setInput(name, value)(bad name / type / cap → ignored with a debug warning);ctx.inputexposes the current values.ComponentEngine.commitInputis the shared path. Anupdatesendingcontentortemplate/dataclearsstate.input; other updates keep it.mapContext.component.items[].input(incontextHash),meta.lastInteraction{event: "input", name, value},getstate.input. - Dragged / placed markers keep
config.lngLatas declared and store the position instate.lngLat+moved: true(previously the drag rewroteconfig). Rendering,getstate.lngLatandexportuse it; anupdatewithoutlngLat(e.g. a new icon) keeps the dragged position; anupdatewithlngLat/alongresets it (moved: false,updatedeven when the value equals the config). - Route option chosen by the user (tap on an alternative) writes only
state.selectedOptionIndex(previously an internalupdaterewroteconfig.selectedOptionIndex): re-rendered with the state index,selectwithby: "user", noupdated. An ownerupdatewithoutselectedOptionIndex/coordinates/alternatives/routeTypekeeps the choice; one that sends any of them resets it to the config value (new geometry still re-selects option 0) — discarding a different user choice is a real change (updated.changedhasselectedOptionIndex,selectby: "batch"), even when the config is identical.getstate,mapContext,fitBounds, bbox, markers along the route andexportuse the effective index;addreplacing the route resets it. exportnow merges the overlay into the config (dragged position, chosen option,open: false, entered values asinputs[].value);getkeepsconfigandstateapart.- No lost user writes while a run is being applied: when the applied run is
committed to the Component Memory, entries the run did not touch are taken from
the live store, and every
updateitem re-carries the overlay written meanwhile (entered values, dragged / placed position, chosen option,openfrom a user close orsetOpen) for the field groups it did not send;addcarries nothing. If the carried overlay changes what is drawn, the component is re-rendered silently, and the popup overlay shows the carried values.
- Popup inputs:
- Host writes
ComponentEngine.add / update / remove(items)(spec §10.12): onecomponent.*action withorigin: "app"throughexecuteBatchQueued(Pha A on a draft, lifecycle events); returns the actiondata, throwsSMComponentError(witherrors[]and the fullresult) when rejected. Seam addition:ComponentHost.executeBatchQueued.
AMJSON Theme, preset, sprite pins, componentVersions (phase 2, protocol sync 2026-10-07) #
Spec: ai-map-protocol/sharemap-amjson-theme.md (new), sharemap-amjson-components.md
§5.2 / §5.6 / §6.2 / §7.4 / §10.2 / §10.5 / §11, ai-map-protocol.md §3.1 / §7.2,
schemas amjson-command / -input / -result / -transport / -theme (new), all
protocol examples re-synced into test/fixtures/ (whole examples/ tree, plus
amjson_theme/sharemap.json, amjson_cases/, amjson_toolgroups/, amjson_usage/).
componentVersions(components doc 5.6) —kComponentVersions{ marker: "1.0", route: "1.0", popup: "1.0" }, written right afterversion: in every[1]the runtime builds (buildMapAgentInput), in every[3](JsonResult.componentVersions, defaultkComponentVersions; also the remote runtime's result packet) and in every[2]the host write API /SMMarker/SMRoute/SMPopupcompose (buildComponentBatch— only the types the items use).JsonCommandBatch.componentVersionsis parsed and kept on incoming[2]; the envelope check (validateBatchJson) only enforces what the schema enforces — presence when the batch has acomponent.*action and the shape (non-empty, keysmarker | route | popup, valuesMAJOR.MINOR) —SCHEMA_INVALIDat/componentVersions. Values are never compared or branched on.- AMJSON Theme.
themes/sharemap.jsonis embedded (kSharemapThemeJson,ComponentTheme.sharemap), the theme schema too (kAmjsonThemeSchemaJson, both drift-checked against the fixtures).ComponentEngine(theme: json)/ShareMapLibre(componentTheme: json)load a theme at setup,engine.setTheme(json)later,engine.theme→{name, version},engine.currentThemethe mergedComponentTheme. Loading (theme doc 5.1): schema →extendsresolved against the themes already loaded (sharemapalways; chain ≤ 4) with deep merge (nulldeletes) → merged result must be a complete root theme (§7) → ≤ 64 KB; any failure throwsComponentThemeErrorand the current theme stays. Compile (5.2 / 5.3): the fixed layers take their fallbacks fromtheme.<type>.default— route layers from thelinestroke (capconstant and the dash layer's pattern fromremaining.dash, see below), marker labeltext-size/text-color/text-halo-*plusicon-size/icon-opacityfrommarker.default;icon-imagefalls back topin,icon-anchortobottom. A component compiles astheme.default ← presets[preset] ← its own tokensand writes only tokens that differ from the layer fallback: a component with no tokens carries identity keys + geometry only (routes keepsm:ccolor/sm:cwidthbecause the casing layer filters onhas).setTheme(5.4) is one pass after idle (waits for drags / progress transitions):setLayerPropertieson every fixed layer in place (no remove / add), every Component Memory entry recompiled, onesetGeoJsonSourceper changed source, theme images (dots, framed sprites) re-drawn and stale ones released, popup overlays re-framed, no lifecycle events; samename+versionis a no-op; a basemap style reload rebuilds the fixed resources with the current theme. Popupdefault/ preset frame tokens are the overlay defaults; the look tokens (background,foreground,muted,accent,radiusPx,shadow) travel asPopupOverlaySpec.lookand become a localThemeof the default popup card (templates read them throughTheme.of(context)). presetcommon attribute (components doc 5.2, theme doc 4) on marker / route / popup:^[a-z][a-z0-9-]{0,39}$ornull; a name not in the current theme →PRESET_NOT_FOUND(newErrorCodes.presetNotFound, in the registry) withpathandrepair.available= the theme's presets of that type;updatewith a new preset keeps the component's own overrides,preset: nullreturns todefault.mapContext.component.items[].preset;capabilities.theme = { name, version, presets: { marker[], route[], popup[] } }(ComponentHandler.themeCapability). The per-strokepresetinroute.style.*and the five hardcoded names (primaryActive…) are gone — an unknown key,SCHEMA_INVALID; the stroke / label defaults that used to be constants incomponent_defaults.dart/component_fixtures.dartnow come from the theme.- Marker icon
{ name }(components doc 6.2):kind: "pin" | "other", defaultpin.pin→name∈pin | pin-blue | pin-orange | pin-red(sprite pins), anchorbottom, optionalpinText(1–2 chars) +pinTextColor(defaultmarker.pin.textColor, white);other→ any sprite name (ICON_NOT_FOUNDotherwise), anchorcenter, nopinText. Every invalid combination isSCHEMA_INVALIDat the precise path (/icon/name,/icon/kind,/icon/pinText,/icon/pinTextColor), matching the schema's if/then rules. The 13 engine built-in pins are gone (kBuiltinPinNames,pin-number,*-blank,ComponentHandler.builtinIcons):capabilities.icons[]lists sprite names only. Rendering: a pin without text is the sprite image itself (sm:icon: "pin-red";pinis the layer fallback, so nosm:icon); a pin with text is drawn by the engine onto a copy of the sprite pin (sm-pintext-{pin}-{text}-{color}, text size scaled for 1 vs 2 chars);{ color }is now a filled dot permarker.dot(sm-dot-{color}-{size}-{borderColor}-{borderWidth},-none-0without border), anchorcenter— no more coloured pin;sm:anchoris written only when ≠bottom.border(theme / preset / component) applies toother, emoji, url and template icons only — never to pins or dots; a framed sprite icon becomes a copysm-sprite-{name}-b…. Omitted icon ={ name: "pin" }.SMIcon.name(name, {kind, pinText, pinTextColor, sizePx}),SMIcon.pin(...),SMIcon.sprite(...);preset:on the three facades. - Tests:
component_theme_test.dart(theme embed / schema drift, load / extends / merge / completeness,capabilities.themeinvariant, preset resolution andPRESET_NOT_FOUND, delta-vs-theme compile invariant, pin kind /pinTextvalidation and image ids, dot ids,componentVersionsin[1]/[3]/ host-API[2]and the envelope check,setTheme— in-place layers, recompile, single write, no events, no-op, invalid keeps current,setTheme ≡ fresh engine, style reload, popup card colours); existing tests updated for the removed built-in pins, the dot, thebottomanchor default and the removed per-stroke preset.
Route stops are always numbered pin-blue sprite pins (protocol sync 2026-10-07) #
Spec: components doc §7.2 (stops, "Marker điểm dừng" → "Hình và số thứ tự"), §7.6 R2 / R3,
schema $defs/RouteStop + stops.maxItems 99, mentions doc §5; fixtures and the embedded
command schema re-synced.
- Every
route.stops[]marker is a sprite pinkind: "pin": omittedicon→pin-blue, or exactly{ name: pin | pin-blue | pin-orange | pin-red }(kind: "pin",sizePxallowed). Any other icon (emoji, url, template,{ color },"none",kind: "other", a non-pin name) and any senderpinText/pinTextColor→SCHEMA_INVALIDat the stop's/icon(/icon/kind,/icon/name,/icon/pinText,/icon/pinTextColor) — checked before the generic icon rules, so no extraICON_NOT_FOUNDrow. The same rule applies to a marker that is a stop when it is updated / re-added on its own (R3). - The engine draws the number:
pinText= 1-based position in the owning route'sstopIds, text colour = thememarker.pin.textColor(sm-pintext-pin-blue-1-ffffff). It is never stored in the stop's config —get/exportstay valid input. Whenever a route's stop list changes (stops re-sent / reordered, a stop removed or moved to another route) every remaining stop is recompiled with its new number in the same single source write, withoutupdatedevents. A stop updated directly (icon: { name: "pin-red" }) keeps its number;icon: nullreturns it topin-blue. ComponentLimits.routeStopsMax100 → 99 (number always ≤ 2 characters).route.stopNumberStart(§7.2): integer 1–99, default 1 (1/nullare not stored in the config;nullinupdate= back to 1). Stopi(0-based) showsstopNumberStart + i. After the merge the engine checksstopNumberStart + stops − 1 ≤ 99(stops sent, or the current list when anupdatedoes not sendstops) →SCHEMA_INVALIDat<item>/stopNumberStart. Changing it renumbers every stop of the route: only the number images not yet loaded are rasterized (ids keyed by content and shared across routes), unreferenced ones are released, stops whose number is unchanged are not rewritten (feature diff), exactly onesm-pointswrite, nosm-lineswrite, noupdatedfor the stops. Re-adding a route with the same stops but another start still redraws them.SMRoute(stopNumberStart:)+setStopNumberStart(int?).mapContext.component.items[].iconof a stop is its pin name (pin-blueby default).- Free markers are unchanged (any icon; the sender may set
pinText). - Tests:
test/engine/component/component_route_stops_test.dart(defaultpin-blue+ numbering, renumber after stops replace and after removing a stop, stop update keeps its number and is validated, invalid stop icons /pinText, export round-trip, 99-stop cap, free markers unaffected,stopNumberStartnumbering / singlesm-pointswrite / overflow / facade).
Sharp markers, centred pin numbers (protocol sync 2026-10-07) #
Spec: components doc §3.3 C2 / C2a, §10.2, §10.5, theme doc §5.2 (mirrors the React fix).
- Blur. MapLibre samples a symbol layer LINEAR as soon as
icon-size/icon-rotateread feature data (oricon-size≠ 1), which made every component marker softer than the style's POI icons. Each group now has the base layersm-marker-{grp}(filter!has sm:tf, constanticon-size= thememarker.default.scale, noicon-rotate) and a lazily builtsm-marker-{grp}-transform(filterhas sm:tf, data-driven size / rotate), pruned when unused — also inz0; a group's animation layer stays while its transform layer is used. Features carrysm:tf: truewhen they havesm:size,sm:rotate,along.rotateor an image-scale compensationsm:isize. Order in a group: base < animation < transform. Taps / long-press queries /setThemecover the new layer. - Pin number off-centre. The number is placed at the centre of the pin head measured
from the sprite pixels (
pinHeadOf: bbox of opaque, non-white pixels in the top 80 %;cy = top + min(d, bboxHeight)/2; fallback(w/2, 0.405·h, 0.65·w)), bold,0.6·d(1 char) /0.5·d(2 chars), centred on the measured ink bounds of the glyphs. - Sharpness of pin-number images. Without
sizePxthe pin is copied 1:1 from the sprite atlas and registered at the atlas's own pixel ratio (no resampling);sm:isizeis computed per image (ImageRatioProvider.pixelRatioFor). Other engine-drawn images use the map's pixel ratio.ShareMapSpriteServicenow loads the@2xatlas on high-density screens (falls back to 1x).
Khoảng lệch — what MapLibre Native cannot do, and the closest behaviour shipped #
Giải thích theo nhóm, ảnh hưởng tới AI và hướng làm tiếp: doc/ios-android-chua-ho-tro.md.
| Spec | On iOS / Android | Why |
|---|---|---|
feature.setState / clearState, interaction.hoverState |
Not advertised; Pha A answers COMMAND_NOT_ALLOWED. Run on web (featureStateSupported, default kIsWeb). hoverState is ignored everywhere |
The plugin throws UnimplementedError for feature-state on Native; the web hover callback carries no layer id |
source.patch |
Patch applied to the engine's copy, whole source re-sent with setGeoJsonSource; transition interpolates Point positions and numeric properties at ~10 fps |
No GeoJSONSource.updateData on Native |
source.addOrUpdate.filter |
Applied as ['all', sourceFilter, layerFilter] on every layer reading the source |
Native GeoJSON sources have no filter |
options.cluster.minPoints |
Ignored | GeojsonSourceProperties has no clusterMinPoints |
Changing options of an existing source |
Source removed and re-added, its layers re-attached | Native cannot change source options in place |
image.remove |
Overwrites the image with a 1×1 transparent PNG and forgets it | No removeImage |
image.add pixelRatio, stretchX/Y, content; SVG |
Ignored; SVG → EXEC_FAILED |
addImage(name, bytes, sdf) only, decoded by the platform |
layer.add.iconTemplate |
Pha A checks the template; execution → EXEC_FAILED (intent-not-expressible, use image.add + icon-image) |
No canvas template rendering on Native yet |
animation dash-flow / pulse |
Timer at ~10 fps re-sends paint (line-dasharray phase cycling, circle-radius/opacity) |
No requestAnimationFrame / line-dash-offset |
interaction.popup, marker.addFromSource.popup |
Content filled from the tapped feature (text only); shown in the component popup overlay, or handed to onTemplatePopup when the app sets it; openOn: hover opens on tap |
No popup widget on Native |
interaction.expandClusterOnClick |
Zooms in two levels at the tap | No getClusterExpansionZoom |
hover events of layers |
Not emitted | No hover on touch; the web hover callback is not wired (no layer id) |
setPaintProperty / setLayoutProperty on a layer the engine did not add |
Merged with the layer's definition from the loaded style JSON; unknown style → EXEC_FAILED |
setLayerProperties overwrites every property |
camera.flyTo.speed / essential |
speed → fixed duration (1.2 ≈ 1.5 s); essential ignored |
Native animations take a duration |
camera.padding |
Not emitted | The library has no persistent view padding yet |
query.renderedFeatures without options.layers |
One query over every layer; strict property whitelist, no layer member |
No layer attribution in that query |
mapContext.source.items |
Sources added straight through the controller (annotation managers, app raster layers) are omitted | Their type is unknown without getStyle() (iOS) |
meta.settled |
false while a live source, animation or transition exists |
idle never comes |
| Component source writes | Whole sm-* source re-sent with setGeoJsonSource, once per changed source per run of component actions |
No updateData on Native (rule A4 allows exactly this) |
| Component images released | Overwritten with a 1×1 transparent PNG | No removeImage |
Route dash / cap tokens |
Every dashed line uses the theme's route.default.remaining.dash pattern (sharemap: [1, 1.5]; a custom dash only switches the line to dashed); cap is always the theme's route.default.line.cap; join is honoured |
Native does not accept data expressions for line-dasharray / line-cap |
Pin with pinText (sprite pin + text) |
The engine copies the pin from the sprite atlas the widget downloads over HTTP (ShareMapSpriteService, the style's sprite URL — the same PNG MapLibre renders) and draws the text on it. When no atlas is loaded (headless engine, style without sprite, atlas still downloading) a vector fallback pin with the ShareMap pin shape and colours (kFallbackPinColors) is drawn instead; image ids stay sm-pintext-{pin}-{text}-{color}. The pin head is measured from the atlas pixels; the vector fallback uses its own circle |
MapLibre Native does not expose the pixels of the sprite it loaded; the atlas has to be fetched separately |
Framed sprite icon (kind: "other" + border) |
Copied from the same HTTP atlas; no atlas → EXEC_FAILED ("sprite icon … is not available in the loaded sprite atlas") |
Same — nothing to draw the frame on without the atlas |
Theme presets.<name>: null (drop an inherited preset, theme doc §8) |
Accepted on themes with extends; the schema check runs on the file with those entries removed, the merge then deletes the preset |
amjson-theme.schema.json only allows preset objects — the doc and the schema disagree; the engine follows the doc for inherited themes and the schema for root themes |
setTheme cost |
Every fixed layer gets setLayerProperties (whole paint + layout re-sent) and each changed sm-* source is re-sent in full |
No setPaintProperty for a single property, no updateData on Native |
| Engine-drawn marker images | Drawn at the device pixel ratio (pin numbers: at the atlas ratio); when the platform's read ratio differs the feature carries sm:isize = platformRatio / imageRatio, folded into icon-size — such markers live on the -transform layer (LINEAR sampling), so on Android / web engine-drawn images cannot be as sharp as sprite icons |
addImage has no pixelRatio: Android / web read the bytes as 1x, iOS at screen scale |
| Marker dragging | Plugin feature drag (draggable: true on the feature; press-and-move on touch, mouse drag on web), positions written to sm-anim-points, dragend with bounds snap-back, placeOnClick on empty-map taps |
No DOM marker; the native drag only reports positions |
contextmenu |
Long press (onMapLongClick) on every platform — no right click on web |
The plugin has no context-menu event |
Component hover |
Web / mouse only (onFeatureHover) |
No hover on touch |
| "One click, one component" | The plugin reports the first interactive feature it hits; the topmost one is not guaranteed when components overlap | Native hit-test order is not exposed |
icon.url with SVG |
EXEC_FAILED at apply ("SVG icon images cannot be rasterized") |
dart:ui cannot decode SVG without an extra dependency |
hideUnderlyingPoi |
Validated (app only) and stored, not applied — the basemap POI under the marker stays visible | Needs per-style POI layer filters; cut from this release |
Marker ariaLabel |
Stored, not exposed to screen readers (popups use Semantics) |
Symbol layers have no accessibility tree |
Event point |
Logical pixels (Android's physical pixels divided by the device pixel ratio) | Android reports physical pixels |
Also in this release (protocol 0.1.0 groundwork, never released on its own) #
- AI Map Protocol 0.1.0 (
kProtocolVersion). Additive:JsonCommandBatchgainsround(default 1),session,citationsand pass-throughusage(malformedusageis dropped, never rejects the batch);JsonResultgainsround,status(ok/partial/rejected) andsessionId;ActionResultgainsrepairandpath. 0.0.1 batches run unchanged. - Engine idempotency cache is keyed by
(responseTo, round)(§9.2). Keying byresponseToalone returned round 1's Result for round 2 of the same turn, so follow-up and repair batches never ran. - New
validateBatchJsonchecks the envelope of a network[2](unknown fields,versionmajor →VERSION_MISMATCH,responseTo,round,onError,actions). - Remote Map Agent client (
lib/src/agent/remote/, AI on the backend):MapAgentAdapter([1]/[3]→[2]/204, typed HTTP errors),MapAgentRuntime(builds[1]withrequestId/sessionId/projectedmapContext/capabilities/client, executes[2]onShareMapEngine, replies[3]withresultFor/round/status/sessionId, loops while200, persistssessionIdthrough an injectableMapAgentSessionStorage) andMapAgentChatControllerfor UI state. - Byte caps (§9.6.1): a
[2]over 8 MiB is not read further (turn fails, no[3]); 4–8 MiB is parsed and answered with arejected[3]where every action isPAYLOAD_TOO_LARGEwithrepair.limit/actual; L3 data in[3]is trimmed to 1 MiB (features dropped from the end,truncated/totalBeforeCap) on a copy, and a[3]over 2 MiB throws instead of being sent. - AMJSON Wire v1 (§9.1.7): AES-256-GCM over raw deflate with a per-session key
from
POST <endpoint>/wire-key;wire: AmjsonWireMode.encby default, falls back to JSON on404/415, retries once onWIRE_KEY_INVALID. Passes every vector ofai-map-protocol/examples/wire/. Ships a strict, bounded raw-inflate decoder (pure Dart, web-safe) that rejects truncated/trailing streams and stops decompression bombs while inflating. - Remote Map Agent is SSE-only (§9.1.4, §9.1.6): the Fleet Map Agent answers
only with
text/event-stream, soMapAgentAdapteralways sendsAccept: text/event-streamfor[1]and[3], reads the response incrementally (UTF-8 + line splitting that survive any chunk boundary, keep-alive comments ignored) and reassembles the frames (§9.1.3) into the[2]exactly likereassemble()inai-map-protocol/scripts/validate.py— includingsessionfrombatch_startandusage/citationsfrombatch_end. Over AMJSON Wire each event'sdata:is a base64url wire packet holding the{type, payload}frame (§9.1.7).204closes the turn;406throws aMapAgentHttpExceptionsaying the agent does not serve SSE; a2xxthat is nottext/event-streamis an error. The415/WIRE_KEY_INVALIDretry-once paths are unchanged. - New
MapAgentStreamException(STREAM_INCOMPLETE): stream ended beforebatch_end, connection lost, silent fortimeoutor longer than the newstreamTimeout(default 5 min), out-of-order/gappedindex,actionCountmismatch, any frame afterbatch_end, malformedprogress. NewMapAgentErrorFrameExceptioncarries the code/message of anerrorframe. The client buffers untilbatch_end, so a broken stream never half-runs a batch. - Progress (§9.1.3
progressframe):MapAgentAdapter.send(onProgress, onMessageDelta)→MapAgentRuntime.ask(onProgress, onMessageDraft)→MapAgentChatController.progress(MapAgentProgress {stage, text, tool}) anddraftMessage, set while thinking and cleared when the turn ends. - Byte caps over the stream: the 8 MiB read cap is cumulative over the raw stream
(plus framing slack) and, over wire, over the inflated frame JSON;
MapAgentReply.byteLengthis the JSON byte length of the reassembled[2], so the 4 MiBrejectedrule is unchanged. ErrorCodesregistry gainsAGENT_UNAVAILABLEandRATE_LIMITED(§7.2,errorframe only — never in[3]).- Web streams too:
package:http'sBrowserClientusesfetchwith aReadableStreambody, so progress arrives as it happens in the browser. The same-origin proxy must pipe the stream without buffering. example_web: the Map Agent panel shows the agent's progress text (stage icon, tool name) and the streamingaiMessagedraft while a turn runs.- New dependencies:
cryptography(AES-GCM, WebCrypto on web) andarchive(raw deflate).httplower bound raised to^1.6.0(AbortableRequest; on the web, cancelling a response subscription that waits for the next chunk). example_web: "Map Agent" mode in the AI Agent screen (default endpoint/api/map-agent/chat).- Debug tool sees the remote Map Agent path.
MapAgentRuntimeemits, only whendebugBus.enabled, around every transport call ([1]and each[3]):remote:send(MapAgentSendEvent:packetinput/result,round,endpoint,wireactually used, plaintext UTF-8bytes, exactbody),remote:progress(MapAgentProgressEvent),remote:receive(MapAgentReceiveEvent:200with the reassembled[2]or204,durationMs) andremote:error(MapAgentErrorEvent:code,httpStatus,message).traceIdis the turn'srequestId, so they group with the engine events of the same turn. The panel shows plaintext packets even though AMJSON Wire encrypts the network — a local, opt-in dev tool; events never carry the wire key,kidor ciphertext. - New debug groups
input,remote("Map Agent") andresult, new flow stagesinput/remote/command/result, andDebugViewMode(client/backend): the Debug Panel gets a "Tự động | LLM ở client | LLM ở backend" switch — auto follows the most recent turn (detectViewMode) — and each mode shows only its own group filters and flow diagram (engine/map in both). DebugStatus.warn(amber in the panel,⚠️in the console; not counted by "Chỉ lỗi" or the 🐞 badge): used forremote:errorwith codeSUPERSEDED.
1.1.0 #
- Layers token: with
xApiKey+secretKey, the SDK now exchanges them for a short-lived token atPOST https://geomesh.sharemap.live/layer/tokenand attaches it as?t=tolayers.sharemap.livetile URLs. Tiles and layers use separate token sources and separate endpoints; a tiles token is rejected by layers. New optionallayersTokenUrloverrides the layers endpoint (dev/staging). - Breaking default:
enableTilesTokennow defaults totrue. Apps without keys keep using the free tier with no extra network calls; apps that set only one ofxApiKey/secretKeyget a configuration warning. - Mobile client identification: every request carries
X-Sharemap-Clientand aSharemapSDK/<version> (...)User-Agent with package name, OS, OS version and device model. Seedoc/mobile_client_identification.md. - Add POI models,
ShareMapPoiService, map controller POI extension, sprite service andShareMapSpriteIconwidget. - Add min zoom for business layers.
- Style requests authenticate with the
x-api-keyheader. - Debug panel logs transformed map requests.
- Warn when a layer or POI call has
xApiKeybut nosecretKey.
1.0.1 #
- Upgrade
sharemap_maplibre_glto0.26.2+sharemap.2, including the corrected iOS CocoaPods and Swift Package identities.
1.0.0 #
- Map requests use MapLibre
transformRequestto resolve authentication for each resource URL. HMAC credentials are sent through thex-api-keyheader; the style loader no longer inserts them into source, tile, or glyph URLs. - Add opt-in
enableTilesToken: acquire and refresh short-lived tiles tokens, attach them as?t=on supported tile hosts, and keep HMAC authentication for business layers and Geomesh APIs. The option remains disabled by default. - Fix Android MapLibre initialization before HTTP client/platform-view setup.
- Fix Dart web compilation by removing an unsupported 64-bit integer literal.
- Pin the hosted
sharemap_maplibre_gldependency to0.26.2+sharemap.1. Known iOS limitation: this dependency still uses the old CocoaPods package identity; iOS integration is not verified for this release. - Android hosts require JDK 21, Android SDK 36, and NDK 28; the pinned MapLibre
dependency specifies NDK
28.1.13356709. - Background Location remains experimental in this release. This version does not certify its stability; see the existing device-test checklist and limits.
- Upgrade from 0.0.5: resolve the new package/dependency versions and perform a full rebuild after the native dependency changes (hot reload is insufficient).
0.0.5 #
- Fix: Switch to published
sharemap_maplibre_gldependency and remove obsoletemaplibre_glgit overrides. - Fix: Restore
ShareMapLibre.isShareMapLayersHoststatic helper. - Fix: Repair missing or empty Android background-location disclosure strings during
setup.
0.1.0-dev.1 #
- Thêm vị trí nền native dạng chủ động bật cho Android và iOS.
- Thêm model vị trí, trạng thái và lỗi đã chuẩn hóa cùng broadcast stream.
- Thêm public options trực tiếp cho bốn tham số Android LocationRequest và năm tham số iOS CLLocationManager; không dùng profile hoặc tracking mode.
- Hợp nhất public entry point: background location được gọi trực tiếp qua
ShareMapLibre.start(),stop(),getStatus()và các stream liên quan. - Breaking: xóa
ShareMapTrackingModevà fieldmodekhỏiShareMapLocationStatus;start()không truyền options vẫn dùng bộ giá trị mặc định tương đương cấu hìnhnormaltrước đây. - Thêm
ShareMapTrackingOptions.maxDurationđể ứng dụng host tùy chọn mốc tự dừng tổng thời lượng phiên; status bổ sungsessionStartedAtvàexpiresAt. - Thêm lệnh setup chạy lặp an toàn và lệnh doctor chỉ đọc cấu hình.
- Thêm example tester tối giản, chỉ dùng public API để tích hợp foreground service Android và Core Location iOS.
- Giữ nguyên API MapLibre hiện có; networking và lưu trữ dữ liệu nằm ngoài plugin.
0.0.3 #
- Fix: Update street style URL path to correct sharemap-streets.json resource endpoint.
0.0.2 #
- Fix: Resolve type compilation error by refactoring class inheritance with createState override.
0.0.1 #
- Bản phát hành đầu tiên của widget ShareMap MapLibre.