@mastra/server 1.58.0-alpha.0 → 1.58.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +246 -0
- package/dist/_types/@mastra_schema-compat/dist/provider-compats/anthropic.d.ts +1 -1
- package/dist/{a2a-CnU9zaGR.js → a2a-8C4O2dVJ.js} +41 -5
- package/dist/a2a-8C4O2dVJ.js.map +1 -0
- package/dist/{a2a-uPi5sPwb.js → a2a-B9X-RdWt.js} +863 -230
- package/dist/a2a-B9X-RdWt.js.map +1 -0
- package/dist/{a2a-DKnwIgiw.cjs → a2a-D1t2fS2L.cjs} +874 -229
- package/dist/a2a-D1t2fS2L.cjs.map +1 -0
- package/dist/{a2a-oM7aqLz4.cjs → a2a-MPoM5lzS.cjs} +41 -5
- package/dist/a2a-MPoM5lzS.cjs.map +1 -0
- package/dist/{agent-builder-BDYN3r89.cjs → agent-builder-D8JyDQ5J.cjs} +2 -2
- package/dist/{agent-builder-BDYN3r89.cjs.map → agent-builder-D8JyDQ5J.cjs.map} +1 -1
- package/dist/{agent-builder-Dqy_qumV.js → agent-builder-DNTFty1u.js} +2 -2
- package/dist/{agent-builder-Dqy_qumV.js.map → agent-builder-DNTFty1u.js.map} +1 -1
- package/dist/{agent-versions-Bsrpa_zb.js → agent-versions-CWEnD62A.js} +4 -4
- package/dist/{agent-versions-Bsrpa_zb.js.map → agent-versions-CWEnD62A.js.map} +1 -1
- package/dist/{agent-versions-CdQGF-3e.cjs → agent-versions-xeysPGel.cjs} +4 -4
- package/dist/{agent-versions-CdQGF-3e.cjs.map → agent-versions-xeysPGel.cjs.map} +1 -1
- package/dist/{agents-Dk2qoJi_.cjs → agents-0Tw3kkD_.cjs} +9 -5
- package/dist/agents-0Tw3kkD_.cjs.map +1 -0
- package/dist/{agents-CYvun9iI.js → agents-uT8ZDE4k.js} +9 -5
- package/dist/agents-uT8ZDE4k.js.map +1 -0
- package/dist/{api-schema-manifest-C5hpdIE_.js → api-schema-manifest-BLv_Z-sd.js} +3 -3
- package/dist/{api-schema-manifest-C5hpdIE_.js.map → api-schema-manifest-BLv_Z-sd.js.map} +1 -1
- package/dist/{api-schema-manifest-7-NC9Dyc.cjs → api-schema-manifest-CFLB0MBA.cjs} +3 -3
- package/dist/{api-schema-manifest-7-NC9Dyc.cjs.map → api-schema-manifest-CFLB0MBA.cjs.map} +1 -1
- package/dist/{background-tasks-DnmhLalp.js → background-tasks-Bzl2tNJq.js} +2 -2
- package/dist/{background-tasks-DnmhLalp.js.map → background-tasks-Bzl2tNJq.js.map} +1 -1
- package/dist/{background-tasks-CYgzzUnb.cjs → background-tasks-DXns62Go.cjs} +2 -2
- package/dist/{background-tasks-CYgzzUnb.cjs.map → background-tasks-DXns62Go.cjs.map} +1 -1
- package/dist/{builder-registry-BoaXBdm_.cjs → builder-registry-CTQyg5l5.cjs} +3 -3
- package/dist/{builder-registry-BoaXBdm_.cjs.map → builder-registry-CTQyg5l5.cjs.map} +1 -1
- package/dist/{builder-registry-DE5w7bNk.js → builder-registry-QAeqpQKB.js} +3 -3
- package/dist/{builder-registry-DE5w7bNk.js.map → builder-registry-QAeqpQKB.js.map} +1 -1
- package/dist/{channels-BqkOxxEk.js → channels-CPTIswT2.js} +2 -2
- package/dist/{channels-BqkOxxEk.js.map → channels-CPTIswT2.js.map} +1 -1
- package/dist/{channels-BonQBJT0.cjs → channels-FoIf30Hv.cjs} +2 -2
- package/dist/{channels-BonQBJT0.cjs.map → channels-FoIf30Hv.cjs.map} +1 -1
- package/dist/{common-CPNOpqxA.js → common-5ZZuR6wj.js} +19 -8
- package/dist/common-5ZZuR6wj.js.map +1 -0
- package/dist/{common-spbwhiWS.cjs → common-DQn8jX5T.cjs} +19 -8
- package/dist/common-DQn8jX5T.cjs.map +1 -0
- package/dist/{conversations-CebKjBfB.cjs → conversations-CcFLCCeF.cjs} +2 -2
- package/dist/{conversations-CebKjBfB.cjs.map → conversations-CcFLCCeF.cjs.map} +1 -1
- package/dist/{conversations-BDD46VBM.js → conversations-DtnawNGm.js} +2 -2
- package/dist/{conversations-BDD46VBM.js.map → conversations-DtnawNGm.js.map} +1 -1
- package/dist/{datasets-Cvix7Rms.cjs → datasets-D2JdQI44.cjs} +44 -2
- package/dist/datasets-D2JdQI44.cjs.map +1 -0
- package/dist/{datasets-dhXnHLAL.js → datasets-Dr1pCC6P.js} +39 -3
- package/dist/datasets-Dr1pCC6P.js.map +1 -0
- package/dist/{default-options-BcPyp2Gx.cjs → default-options-C9HZGjYi.cjs} +6 -3
- package/dist/{default-options-BcPyp2Gx.cjs.map → default-options-C9HZGjYi.cjs.map} +1 -1
- package/dist/{default-options-DGCDKR3I.js → default-options-C9JVjlto.js} +6 -3
- package/dist/{default-options-DGCDKR3I.js.map → default-options-C9JVjlto.js.map} +1 -1
- package/dist/{dist-DGqlUp0b.js → dist-CzzxT_L5.js} +345 -1404
- package/dist/dist-CzzxT_L5.js.map +1 -0
- package/dist/{dist-COHIL6fR.cjs → dist-TkFPtpuy.cjs} +354 -1416
- package/dist/dist-TkFPtpuy.cjs.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-agents-a2a.md +75 -2
- package/dist/docs/references/docs-server-custom-adapters.md +1 -1
- package/dist/docs/references/reference-server-routes.md +38 -24
- package/dist/{stored-workflows-OanG0TmB.js → dynamic-workflows-CQs6_anZ.js} +62 -62
- package/dist/dynamic-workflows-CQs6_anZ.js.map +1 -0
- package/dist/{stored-workflows-pCiWK305.cjs → dynamic-workflows-CrvwGZj8.cjs} +71 -71
- package/dist/dynamic-workflows-CrvwGZj8.cjs.map +1 -0
- package/dist/{editor-builder-CWTGCtNu.cjs → editor-builder-C3ZvffGu.cjs} +2 -2
- package/dist/{editor-builder-CWTGCtNu.cjs.map → editor-builder-C3ZvffGu.cjs.map} +1 -1
- package/dist/{editor-builder-Ct2nIbum.js → editor-builder-D5lhXbvj.js} +3 -3
- package/dist/{editor-builder-Ct2nIbum.js.map → editor-builder-D5lhXbvj.js.map} +1 -1
- package/dist/{editor-builder-BW4nlDcX.cjs → editor-builder-DG5-7x6V.cjs} +3 -3
- package/dist/{editor-builder-BW4nlDcX.cjs.map → editor-builder-DG5-7x6V.cjs.map} +1 -1
- package/dist/{editor-builder-fKbRRlK_.js → editor-builder-DJUxdzC8.js} +2 -2
- package/dist/{editor-builder-fKbRRlK_.js.map → editor-builder-DJUxdzC8.js.map} +1 -1
- package/dist/{logs-wBYi7UWL.cjs → logs-BDuGFqxu.cjs} +2 -2
- package/dist/{logs-wBYi7UWL.cjs.map → logs-BDuGFqxu.cjs.map} +1 -1
- package/dist/{logs-BzwWWl57.js → logs-Cz5NiwGP.js} +2 -2
- package/dist/{logs-BzwWWl57.js.map → logs-Cz5NiwGP.js.map} +1 -1
- package/dist/{mcp-DusNUBdz.cjs → mcp-Buvksst5.cjs} +2 -2
- package/dist/{mcp-DusNUBdz.cjs.map → mcp-Buvksst5.cjs.map} +1 -1
- package/dist/{mcp-client-versions-Db71zP8j.cjs → mcp-client-versions-CG7po4hq.cjs} +2 -2
- package/dist/{mcp-client-versions-Db71zP8j.cjs.map → mcp-client-versions-CG7po4hq.cjs.map} +1 -1
- package/dist/{mcp-client-versions-Dwbiav9P.js → mcp-client-versions-Co8d39A6.js} +2 -2
- package/dist/{mcp-client-versions-Dwbiav9P.js.map → mcp-client-versions-Co8d39A6.js.map} +1 -1
- package/dist/{mcp-BpC_5RhI.js → mcp-oOFVSK8L.js} +2 -2
- package/dist/{mcp-BpC_5RhI.js.map → mcp-oOFVSK8L.js.map} +1 -1
- package/dist/{memory-BjemiyZJ.js → memory-CBLqn9xl.js} +2 -2
- package/dist/{memory-BjemiyZJ.js.map → memory-CBLqn9xl.js.map} +1 -1
- package/dist/{memory-CxM2p78x.cjs → memory-D0prxytx.cjs} +2 -2
- package/dist/{memory-CxM2p78x.cjs.map → memory-D0prxytx.cjs.map} +1 -1
- package/dist/{observability-new-endpoints-YK2DjZto.js → observability-new-endpoints-6HLxLS-H.js} +2 -2
- package/dist/{observability-new-endpoints-YK2DjZto.js.map → observability-new-endpoints-6HLxLS-H.js.map} +1 -1
- package/dist/{observability-new-endpoints-Dk3oatL8.cjs → observability-new-endpoints-D4AWoyDe.cjs} +2 -2
- package/dist/{observability-new-endpoints-Dk3oatL8.cjs.map → observability-new-endpoints-D4AWoyDe.cjs.map} +1 -1
- package/dist/{probe-image-size-DYJVSL0b.cjs → probe-image-size-C2F59z8Z.cjs} +56 -1707
- package/dist/probe-image-size-C2F59z8Z.cjs.map +1 -0
- package/dist/{probe-image-size-BQgIJeY_.js → probe-image-size-mXCWYNrz.js} +22 -1673
- package/dist/probe-image-size-mXCWYNrz.js.map +1 -0
- package/dist/{prompt-block-versions-CIDwXWiC.js → prompt-block-versions-CBjHhMVK.js} +2 -2
- package/dist/{prompt-block-versions-CIDwXWiC.js.map → prompt-block-versions-CBjHhMVK.js.map} +1 -1
- package/dist/{prompt-block-versions-Bl3RmkTE.cjs → prompt-block-versions-Cgt_Grk2.cjs} +2 -2
- package/dist/{prompt-block-versions-Bl3RmkTE.cjs.map → prompt-block-versions-Cgt_Grk2.cjs.map} +1 -1
- package/dist/{route-builder-CgLVYL1c.cjs → route-builder-BBovb2TE.cjs} +2 -2
- package/dist/route-builder-BBovb2TE.cjs.map +1 -0
- package/dist/{route-builder-CIk5k35M.js → route-builder-CQkb7tQY.js} +2 -2
- package/dist/route-builder-CQkb7tQY.js.map +1 -0
- package/dist/{routes-hSY4wTeS.cjs → routes-CzvDlbRt.cjs} +26 -25
- package/dist/routes-CzvDlbRt.cjs.map +1 -0
- package/dist/{routes-CRoTKPvQ.js → routes-D_-O6SS5.js} +27 -26
- package/dist/routes-D_-O6SS5.js.map +1 -0
- package/dist/{schedules-CK3-IE0h.cjs → schedules-CfNABln2.cjs} +2 -2
- package/dist/{schedules-CK3-IE0h.cjs.map → schedules-CfNABln2.cjs.map} +1 -1
- package/dist/{schedules-qxFoU-Tb.js → schedules-DSkYO_Nl.js} +2 -2
- package/dist/{schedules-qxFoU-Tb.js.map → schedules-DSkYO_Nl.js.map} +1 -1
- package/dist/{schema-Bv9OdW1f-BY6u3u8K.cjs → schema-Bv9OdW1f-CHHI-NTr.cjs} +2 -76
- package/dist/schema-Bv9OdW1f-CHHI-NTr.cjs.map +1 -0
- package/dist/{schema-Bv9OdW1f-CIOfv-3w.js → schema-Bv9OdW1f-DLSJSqQv.js} +2 -76
- package/dist/schema-Bv9OdW1f-DLSJSqQv.js.map +1 -0
- package/dist/schema-CGeYTFwm.js +2 -0
- package/dist/schema-DkBbires.cjs +1 -0
- package/dist/{scorer-versions-DpmAJKsY.cjs → scorer-versions-CYXtxMTU.cjs} +3 -3
- package/dist/{scorer-versions-DpmAJKsY.cjs.map → scorer-versions-CYXtxMTU.cjs.map} +1 -1
- package/dist/{scorer-versions-BA8N488c.js → scorer-versions-CdVjOtQO.js} +3 -3
- package/dist/{scorer-versions-BA8N488c.js.map → scorer-versions-CdVjOtQO.js.map} +1 -1
- package/dist/{scores-DU0o86rP.js → scores-B1IdMcDj.js} +2 -2
- package/dist/{scores-DU0o86rP.js.map → scores-B1IdMcDj.js.map} +1 -1
- package/dist/{scores-Bm_sUKY1.cjs → scores-C_Au9jSw.cjs} +2 -2
- package/dist/{scores-Bm_sUKY1.cjs.map → scores-C_Au9jSw.cjs.map} +1 -1
- package/dist/server/a2a/store.cjs +30 -2
- package/dist/server/a2a/store.cjs.map +1 -1
- package/dist/server/a2a/store.d.ts +21 -2
- package/dist/server/a2a/store.d.ts.map +1 -1
- package/dist/server/a2a/store.js +30 -3
- package/dist/server/a2a/store.js.map +1 -1
- package/dist/server/a2a/task-state.d.ts +4 -0
- package/dist/server/a2a/task-state.d.ts.map +1 -0
- package/dist/server/a2a/tasks.d.ts +1 -1
- package/dist/server/a2a/tasks.d.ts.map +1 -1
- package/dist/server/handlers/a2a.cjs +3 -1
- package/dist/server/handlers/a2a.d.ts +155 -12
- package/dist/server/handlers/a2a.d.ts.map +1 -1
- package/dist/server/handlers/a2a.js +2 -2
- package/dist/server/handlers/agent-builder.cjs +7 -7
- package/dist/server/handlers/agent-builder.d.ts +4 -4
- package/dist/server/handlers/agent-builder.js +7 -7
- package/dist/server/handlers/agent-controller.cjs +86 -17
- package/dist/server/handlers/agent-controller.cjs.map +1 -1
- package/dist/server/handlers/agent-controller.d.ts +4 -3
- package/dist/server/handlers/agent-controller.d.ts.map +1 -1
- package/dist/server/handlers/agent-controller.js +86 -17
- package/dist/server/handlers/agent-controller.js.map +1 -1
- package/dist/server/handlers/agent-versions.cjs +10 -4
- package/dist/server/handlers/agent-versions.cjs.map +1 -1
- package/dist/server/handlers/agent-versions.d.ts +88 -16
- package/dist/server/handlers/agent-versions.d.ts.map +1 -1
- package/dist/server/handlers/agent-versions.js +10 -4
- package/dist/server/handlers/agent-versions.js.map +1 -1
- package/dist/server/handlers/agents.cjs +6 -6
- package/dist/server/handlers/agents.d.ts +50 -8
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +6 -6
- package/dist/server/handlers/auth.cjs +1 -1
- package/dist/server/handlers/auth.js +1 -1
- package/dist/server/handlers/background-tasks.cjs +1 -1
- package/dist/server/handlers/background-tasks.js +1 -1
- package/dist/server/handlers/builder-registry.cjs +1 -1
- package/dist/server/handlers/builder-registry.js +1 -1
- package/dist/server/handlers/channels.cjs +1 -1
- package/dist/server/handlers/channels.js +1 -1
- package/dist/server/handlers/conversations.cjs +2 -2
- package/dist/server/handlers/conversations.js +2 -2
- package/dist/server/handlers/datasets.cjs +28 -13
- package/dist/server/handlers/datasets.cjs.map +1 -1
- package/dist/server/handlers/datasets.d.ts +136 -0
- package/dist/server/handlers/datasets.d.ts.map +1 -1
- package/dist/server/handlers/datasets.js +28 -13
- package/dist/server/handlers/datasets.js.map +1 -1
- package/dist/server/handlers/dynamic-workflows.cjs +6 -0
- package/dist/server/handlers/{stored-workflows.d.ts → dynamic-workflows.d.ts} +14 -14
- package/dist/server/handlers/{stored-workflows.d.ts.map → dynamic-workflows.d.ts.map} +1 -1
- package/dist/server/handlers/dynamic-workflows.js +2 -0
- package/dist/server/handlers/editor-builder.cjs +1 -1
- package/dist/server/handlers/editor-builder.js +1 -1
- package/dist/server/handlers/favorites-enrichment.cjs +1 -1
- package/dist/server/handlers/favorites-enrichment.js +1 -1
- package/dist/server/handlers/logs.cjs +3 -3
- package/dist/server/handlers/logs.js +3 -3
- package/dist/server/handlers/mcp-client-versions.cjs +3 -3
- package/dist/server/handlers/mcp-client-versions.js +3 -3
- package/dist/server/handlers/mcp.cjs +2 -2
- package/dist/server/handlers/mcp.js +2 -2
- package/dist/server/handlers/memory.cjs +2 -2
- package/dist/server/handlers/memory.js +2 -2
- package/dist/server/handlers/observability-new-endpoints.cjs +1 -1
- package/dist/server/handlers/observability-new-endpoints.js +1 -1
- package/dist/server/handlers/observability-shared.cjs +1 -1
- package/dist/server/handlers/observability-shared.js +1 -1
- package/dist/server/handlers/observability.cjs +22 -11
- package/dist/server/handlers/observability.cjs.map +1 -1
- package/dist/server/handlers/observability.d.ts.map +1 -1
- package/dist/server/handlers/observability.js +22 -11
- package/dist/server/handlers/observability.js.map +1 -1
- package/dist/server/handlers/processor-providers.cjs +1 -1
- package/dist/server/handlers/processor-providers.js +1 -1
- package/dist/server/handlers/processors.cjs +1 -1
- package/dist/server/handlers/processors.js +1 -1
- package/dist/server/handlers/prompt-block-versions.cjs +3 -3
- package/dist/server/handlers/prompt-block-versions.js +3 -3
- package/dist/server/handlers/responses.cjs +1 -1
- package/dist/server/handlers/responses.js +1 -1
- package/dist/server/handlers/schedules.cjs +1 -1
- package/dist/server/handlers/schedules.js +1 -1
- package/dist/server/handlers/scorer-versions.cjs +3 -3
- package/dist/server/handlers/scorer-versions.js +3 -3
- package/dist/server/handlers/scores.cjs +3 -3
- package/dist/server/handlers/scores.js +3 -3
- package/dist/server/handlers/stored-agent-favorites.cjs +4 -4
- package/dist/server/handlers/stored-agent-favorites.js +4 -4
- package/dist/server/handlers/stored-agents.cjs +21 -6
- package/dist/server/handlers/stored-agents.cjs.map +1 -1
- package/dist/server/handlers/stored-agents.d.ts +100 -16
- package/dist/server/handlers/stored-agents.d.ts.map +1 -1
- package/dist/server/handlers/stored-agents.js +21 -6
- package/dist/server/handlers/stored-agents.js.map +1 -1
- package/dist/server/handlers/stored-mcp-clients.cjs +4 -4
- package/dist/server/handlers/stored-mcp-clients.js +4 -4
- package/dist/server/handlers/stored-prompt-blocks.cjs +4 -4
- package/dist/server/handlers/stored-prompt-blocks.js +4 -4
- package/dist/server/handlers/stored-scorers.cjs +4 -4
- package/dist/server/handlers/stored-scorers.js +4 -4
- package/dist/server/handlers/stored-skill-favorites.cjs +4 -4
- package/dist/server/handlers/stored-skill-favorites.js +4 -4
- package/dist/server/handlers/stored-skills.cjs +4 -4
- package/dist/server/handlers/stored-skills.js +4 -4
- package/dist/server/handlers/stored-workspaces.cjs +3 -3
- package/dist/server/handlers/stored-workspaces.js +3 -3
- package/dist/server/handlers/system.cjs +2 -2
- package/dist/server/handlers/system.js +2 -2
- package/dist/server/handlers/tool-providers.cjs +1 -1
- package/dist/server/handlers/tool-providers.js +1 -1
- package/dist/server/handlers/tools.cjs +6 -6
- package/dist/server/handlers/tools.js +6 -6
- package/dist/server/handlers/validate-agent-instructions.cjs +52 -0
- package/dist/server/handlers/validate-agent-instructions.cjs.map +1 -0
- package/dist/server/handlers/validate-agent-instructions.d.ts +13 -0
- package/dist/server/handlers/validate-agent-instructions.d.ts.map +1 -0
- package/dist/server/handlers/validate-agent-instructions.js +51 -0
- package/dist/server/handlers/validate-agent-instructions.js.map +1 -0
- package/dist/server/handlers/vector.cjs +2 -2
- package/dist/server/handlers/vector.js +2 -2
- package/dist/server/handlers/workflows.cjs +161 -27
- package/dist/server/handlers/workflows.cjs.map +1 -1
- package/dist/server/handlers/workflows.d.ts +13 -4
- package/dist/server/handlers/workflows.d.ts.map +1 -1
- package/dist/server/handlers/workflows.js +161 -29
- package/dist/server/handlers/workflows.js.map +1 -1
- package/dist/server/handlers/workspace.cjs +1 -1
- package/dist/server/handlers/workspace.js +1 -1
- package/dist/server/handlers.cjs +8 -8
- package/dist/server/handlers.d.ts +1 -1
- package/dist/server/handlers.d.ts.map +1 -1
- package/dist/server/handlers.js +3 -3
- package/dist/server/schemas/a2a.d.ts +70 -6
- package/dist/server/schemas/a2a.d.ts.map +1 -1
- package/dist/server/schemas/agent-versions.d.ts +70 -10
- package/dist/server/schemas/agent-versions.d.ts.map +1 -1
- package/dist/server/schemas/agents.d.ts +23 -3
- package/dist/server/schemas/agents.d.ts.map +1 -1
- package/dist/server/schemas/common.d.ts.map +1 -1
- package/dist/server/schemas/datasets.d.ts +53 -0
- package/dist/server/schemas/datasets.d.ts.map +1 -1
- package/dist/server/schemas/default-options.d.ts +7 -1
- package/dist/server/schemas/default-options.d.ts.map +1 -1
- package/dist/server/schemas/{stored-workflows.d.ts → dynamic-workflows.d.ts} +13 -13
- package/dist/server/schemas/dynamic-workflows.d.ts.map +1 -0
- package/dist/server/schemas/index.cjs +26 -25
- package/dist/server/schemas/index.js +26 -26
- package/dist/server/schemas/stored-agents.d.ts +140 -20
- package/dist/server/schemas/stored-agents.d.ts.map +1 -1
- package/dist/server/schemas/workflows.d.ts +10 -2
- package/dist/server/schemas/workflows.d.ts.map +1 -1
- package/dist/server/server-adapter/index.cjs +44 -3
- package/dist/server/server-adapter/index.cjs.map +1 -1
- package/dist/server/server-adapter/index.d.ts +37 -0
- package/dist/server/server-adapter/index.d.ts.map +1 -1
- package/dist/server/server-adapter/index.js +45 -5
- package/dist/server/server-adapter/index.js.map +1 -1
- package/dist/server/server-adapter/routes/a2a.d.ts +116 -8
- package/dist/server/server-adapter/routes/a2a.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/agent-builder.d.ts +4 -4
- package/dist/server/server-adapter/routes/datasets.d.ts +136 -0
- package/dist/server/server-adapter/routes/datasets.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/dynamic-workflows.d.ts +16 -0
- package/dist/server/server-adapter/routes/dynamic-workflows.d.ts.map +1 -0
- package/dist/server/server-adapter/routes/index.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/workflows.d.ts +11 -5
- package/dist/server/server-adapter/routes/workflows.d.ts.map +1 -1
- package/dist/{stored-agents-D8ar1Pn7.js → stored-agents-BRBZM-Xl.js} +4 -4
- package/dist/{stored-agents-D8ar1Pn7.js.map → stored-agents-BRBZM-Xl.js.map} +1 -1
- package/dist/{stored-agents-DKd89v5z.cjs → stored-agents-CPxfYRH9.cjs} +4 -4
- package/dist/{stored-agents-DKd89v5z.cjs.map → stored-agents-CPxfYRH9.cjs.map} +1 -1
- package/dist/{stored-mcp-clients-CwA5_nZ9.cjs → stored-mcp-clients-CJJPe_09.cjs} +2 -2
- package/dist/{stored-mcp-clients-CwA5_nZ9.cjs.map → stored-mcp-clients-CJJPe_09.cjs.map} +1 -1
- package/dist/{stored-mcp-clients-DJ3E4g8-.js → stored-mcp-clients-CoCfZRhw.js} +2 -2
- package/dist/{stored-mcp-clients-DJ3E4g8-.js.map → stored-mcp-clients-CoCfZRhw.js.map} +1 -1
- package/dist/{stored-prompt-blocks-BlqcqnEX.js → stored-prompt-blocks-DcmkZaCm.js} +2 -2
- package/dist/{stored-prompt-blocks-BlqcqnEX.js.map → stored-prompt-blocks-DcmkZaCm.js.map} +1 -1
- package/dist/{stored-prompt-blocks-DR_Wts8r.cjs → stored-prompt-blocks-XI4frgZv.cjs} +2 -2
- package/dist/{stored-prompt-blocks-DR_Wts8r.cjs.map → stored-prompt-blocks-XI4frgZv.cjs.map} +1 -1
- package/dist/{stored-scorers-BIKumDRO.js → stored-scorers-B__LF0Cy.js} +3 -3
- package/dist/{stored-scorers-BIKumDRO.js.map → stored-scorers-B__LF0Cy.js.map} +1 -1
- package/dist/{stored-scorers-_dqFdh-G.cjs → stored-scorers-Cml7jPJv.cjs} +3 -3
- package/dist/{stored-scorers-_dqFdh-G.cjs.map → stored-scorers-Cml7jPJv.cjs.map} +1 -1
- package/dist/{stored-skills-CgwoCNNV.cjs → stored-skills-BqNK0ssS.cjs} +2 -2
- package/dist/{stored-skills-CgwoCNNV.cjs.map → stored-skills-BqNK0ssS.cjs.map} +1 -1
- package/dist/{stored-skills-B_aAMn5W.js → stored-skills-JTWbMybs.js} +2 -2
- package/dist/{stored-skills-B_aAMn5W.js.map → stored-skills-JTWbMybs.js.map} +1 -1
- package/dist/{stored-workspaces-Dib-ClOP.js → stored-workspaces-6PYE4Y3m.js} +2 -2
- package/dist/{stored-workspaces-Dib-ClOP.js.map → stored-workspaces-6PYE4Y3m.js.map} +1 -1
- package/dist/{stored-workspaces-CbJQaFuP.cjs → stored-workspaces-Dl8B20LD.cjs} +2 -2
- package/dist/{stored-workspaces-CbJQaFuP.cjs.map → stored-workspaces-Dl8B20LD.cjs.map} +1 -1
- package/dist/sync-BHatXKfg.cjs +1679 -0
- package/dist/sync-BHatXKfg.cjs.map +1 -0
- package/dist/sync-djJ8Lmds.js +1656 -0
- package/dist/sync-djJ8Lmds.js.map +1 -0
- package/dist/{utils-wESuBh27.cjs → utils-Bna_JCkb.cjs} +3 -3
- package/dist/{utils-wESuBh27.cjs.map → utils-Bna_JCkb.cjs.map} +1 -1
- package/dist/{utils-BUK03Frl.js → utils-QXKhjIm6.js} +3 -3
- package/dist/{utils-BUK03Frl.js.map → utils-QXKhjIm6.js.map} +1 -1
- package/dist/{vectors-CZY34X8R.js → vectors-Ck7Qu6yz.js} +2 -2
- package/dist/{vectors-CZY34X8R.js.map → vectors-Ck7Qu6yz.js.map} +1 -1
- package/dist/{vectors-Cj-SPxOy.cjs → vectors-D6uZn2f1.cjs} +2 -2
- package/dist/{vectors-Cj-SPxOy.cjs.map → vectors-D6uZn2f1.cjs.map} +1 -1
- package/dist/{version-common-CEBQY7M8.cjs → version-common-AtNRQ5xH.cjs} +2 -2
- package/dist/{version-common-CEBQY7M8.cjs.map → version-common-AtNRQ5xH.cjs.map} +1 -1
- package/dist/{version-common-Cmd1f9JX.js → version-common-CudZ_WuW.js} +2 -2
- package/dist/{version-common-Cmd1f9JX.js.map → version-common-CudZ_WuW.js.map} +1 -1
- package/dist/{workflows-XfiENvkF.cjs → workflows--79xhOOb.cjs} +14 -3
- package/dist/workflows--79xhOOb.cjs.map +1 -0
- package/dist/{workflows-DPW6FrY0.js → workflows-B2ooCiwN.js} +9 -4
- package/dist/workflows-B2ooCiwN.js.map +1 -0
- package/package.json +8 -8
- package/dist/a2a-CnU9zaGR.js.map +0 -1
- package/dist/a2a-DKnwIgiw.cjs.map +0 -1
- package/dist/a2a-oM7aqLz4.cjs.map +0 -1
- package/dist/a2a-uPi5sPwb.js.map +0 -1
- package/dist/agents-CYvun9iI.js.map +0 -1
- package/dist/agents-Dk2qoJi_.cjs.map +0 -1
- package/dist/common-CPNOpqxA.js.map +0 -1
- package/dist/common-spbwhiWS.cjs.map +0 -1
- package/dist/datasets-Cvix7Rms.cjs.map +0 -1
- package/dist/datasets-dhXnHLAL.js.map +0 -1
- package/dist/dist-COHIL6fR.cjs.map +0 -1
- package/dist/dist-DGqlUp0b.js.map +0 -1
- package/dist/probe-image-size-BQgIJeY_.js.map +0 -1
- package/dist/probe-image-size-DYJVSL0b.cjs.map +0 -1
- package/dist/route-builder-CIk5k35M.js.map +0 -1
- package/dist/route-builder-CgLVYL1c.cjs.map +0 -1
- package/dist/routes-CRoTKPvQ.js.map +0 -1
- package/dist/routes-hSY4wTeS.cjs.map +0 -1
- package/dist/schema-B8-5YCsA.js +0 -2
- package/dist/schema-BieM1qrc.cjs +0 -1
- package/dist/schema-Bv9OdW1f-BY6u3u8K.cjs.map +0 -1
- package/dist/schema-Bv9OdW1f-CIOfv-3w.js.map +0 -1
- package/dist/server/handlers/stored-workflows.cjs +0 -6
- package/dist/server/handlers/stored-workflows.js +0 -2
- package/dist/server/schemas/stored-workflows.d.ts.map +0 -1
- package/dist/server/server-adapter/routes/stored-workflows.d.ts +0 -16
- package/dist/server/server-adapter/routes/stored-workflows.d.ts.map +0 -1
- package/dist/stored-workflows-OanG0TmB.js.map +0 -1
- package/dist/stored-workflows-pCiWK305.cjs.map +0 -1
- package/dist/workflows-DPW6FrY0.js.map +0 -1
- package/dist/workflows-XfiENvkF.cjs.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { i as __toESM$1,
|
|
2
|
-
import { n as standardSchemaToJSONSchema, r as toStandardSchema$1, t as isStandardSchemaWithJSON$1 } from "./schema-Bv9OdW1f-
|
|
3
|
-
import "./schema-
|
|
1
|
+
import { i as __toESM$1, t as __commonJSMin$1 } from "./rolldown-runtime-DuvcJU0W.js";
|
|
2
|
+
import { n as standardSchemaToJSONSchema, r as toStandardSchema$1, t as isStandardSchemaWithJSON$1 } from "./schema-Bv9OdW1f-DLSJSqQv.js";
|
|
3
|
+
import "./schema-CGeYTFwm.js";
|
|
4
|
+
import { t as require_sync } from "./sync-djJ8Lmds.js";
|
|
4
5
|
import { openai } from "./dist-DyBO3IVt.js";
|
|
5
6
|
import { createRequire } from "module";
|
|
6
7
|
import * as z4 from "zod/v4";
|
|
@@ -4083,1275 +4084,8 @@ function getCharacterCount(text) {
|
|
|
4083
4084
|
return Array.from(text).length;
|
|
4084
4085
|
}
|
|
4085
4086
|
//#endregion
|
|
4086
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/inherits/2.0.4/3ed134d32829ca149a6c475be3507d0f5d7d58b7bb2c1b0fb4c43b3e2f7ba5d2/node_modules/inherits/inherits_browser.js
|
|
4087
|
-
var require_inherits_browser = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
4088
|
-
if (typeof Object.create === "function") module.exports = function inherits(ctor, superCtor) {
|
|
4089
|
-
if (superCtor) {
|
|
4090
|
-
ctor.super_ = superCtor;
|
|
4091
|
-
ctor.prototype = Object.create(superCtor.prototype, { constructor: {
|
|
4092
|
-
value: ctor,
|
|
4093
|
-
enumerable: false,
|
|
4094
|
-
writable: true,
|
|
4095
|
-
configurable: true
|
|
4096
|
-
} });
|
|
4097
|
-
}
|
|
4098
|
-
};
|
|
4099
|
-
else module.exports = function inherits(ctor, superCtor) {
|
|
4100
|
-
if (superCtor) {
|
|
4101
|
-
ctor.super_ = superCtor;
|
|
4102
|
-
var TempCtor = function() {};
|
|
4103
|
-
TempCtor.prototype = superCtor.prototype;
|
|
4104
|
-
ctor.prototype = new TempCtor();
|
|
4105
|
-
ctor.prototype.constructor = ctor;
|
|
4106
|
-
}
|
|
4107
|
-
};
|
|
4108
|
-
}));
|
|
4109
|
-
//#endregion
|
|
4110
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/inherits/2.0.4/3ed134d32829ca149a6c475be3507d0f5d7d58b7bb2c1b0fb4c43b3e2f7ba5d2/node_modules/inherits/inherits.js
|
|
4111
|
-
var require_inherits = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
4112
|
-
try {
|
|
4113
|
-
var util = __require("util");
|
|
4114
|
-
/* istanbul ignore next */
|
|
4115
|
-
if (typeof util.inherits !== "function") throw "";
|
|
4116
|
-
module.exports = util.inherits;
|
|
4117
|
-
} catch (e) {
|
|
4118
|
-
/* istanbul ignore next */
|
|
4119
|
-
module.exports = require_inherits_browser();
|
|
4120
|
-
}
|
|
4121
|
-
}));
|
|
4122
|
-
//#endregion
|
|
4123
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/queue/6.0.2/1ff508d6efe0b00278160bee66f3e5c85b96dfb4a4e9ee9d48c68898ab3c428f/node_modules/queue/index.js
|
|
4124
|
-
var require_queue = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
4125
|
-
var inherits = require_inherits();
|
|
4126
|
-
var EventEmitter = __require("events").EventEmitter;
|
|
4127
|
-
module.exports = Queue;
|
|
4128
|
-
module.exports.default = Queue;
|
|
4129
|
-
function Queue(options) {
|
|
4130
|
-
if (!(this instanceof Queue)) return new Queue(options);
|
|
4131
|
-
EventEmitter.call(this);
|
|
4132
|
-
options = options || {};
|
|
4133
|
-
this.concurrency = options.concurrency || Infinity;
|
|
4134
|
-
this.timeout = options.timeout || 0;
|
|
4135
|
-
this.autostart = options.autostart || false;
|
|
4136
|
-
this.results = options.results || null;
|
|
4137
|
-
this.pending = 0;
|
|
4138
|
-
this.session = 0;
|
|
4139
|
-
this.running = false;
|
|
4140
|
-
this.jobs = [];
|
|
4141
|
-
this.timers = {};
|
|
4142
|
-
}
|
|
4143
|
-
inherits(Queue, EventEmitter);
|
|
4144
|
-
[
|
|
4145
|
-
"pop",
|
|
4146
|
-
"shift",
|
|
4147
|
-
"indexOf",
|
|
4148
|
-
"lastIndexOf"
|
|
4149
|
-
].forEach(function(method) {
|
|
4150
|
-
Queue.prototype[method] = function() {
|
|
4151
|
-
return Array.prototype[method].apply(this.jobs, arguments);
|
|
4152
|
-
};
|
|
4153
|
-
});
|
|
4154
|
-
Queue.prototype.slice = function(begin, end) {
|
|
4155
|
-
this.jobs = this.jobs.slice(begin, end);
|
|
4156
|
-
return this;
|
|
4157
|
-
};
|
|
4158
|
-
Queue.prototype.reverse = function() {
|
|
4159
|
-
this.jobs.reverse();
|
|
4160
|
-
return this;
|
|
4161
|
-
};
|
|
4162
|
-
[
|
|
4163
|
-
"push",
|
|
4164
|
-
"unshift",
|
|
4165
|
-
"splice"
|
|
4166
|
-
].forEach(function(method) {
|
|
4167
|
-
Queue.prototype[method] = function() {
|
|
4168
|
-
var methodResult = Array.prototype[method].apply(this.jobs, arguments);
|
|
4169
|
-
if (this.autostart) this.start();
|
|
4170
|
-
return methodResult;
|
|
4171
|
-
};
|
|
4172
|
-
});
|
|
4173
|
-
Object.defineProperty(Queue.prototype, "length", { get: function() {
|
|
4174
|
-
return this.pending + this.jobs.length;
|
|
4175
|
-
} });
|
|
4176
|
-
Queue.prototype.start = function(cb) {
|
|
4177
|
-
if (cb) callOnErrorOrEnd.call(this, cb);
|
|
4178
|
-
this.running = true;
|
|
4179
|
-
if (this.pending >= this.concurrency) return;
|
|
4180
|
-
if (this.jobs.length === 0) {
|
|
4181
|
-
if (this.pending === 0) done.call(this);
|
|
4182
|
-
return;
|
|
4183
|
-
}
|
|
4184
|
-
var self = this;
|
|
4185
|
-
var job = this.jobs.shift();
|
|
4186
|
-
var once = true;
|
|
4187
|
-
var session = this.session;
|
|
4188
|
-
var timeoutId = null;
|
|
4189
|
-
var didTimeout = false;
|
|
4190
|
-
var resultIndex = null;
|
|
4191
|
-
var timeout = job.hasOwnProperty("timeout") ? job.timeout : this.timeout;
|
|
4192
|
-
function next(err, result) {
|
|
4193
|
-
if (once && self.session === session) {
|
|
4194
|
-
once = false;
|
|
4195
|
-
self.pending--;
|
|
4196
|
-
if (timeoutId !== null) {
|
|
4197
|
-
delete self.timers[timeoutId];
|
|
4198
|
-
clearTimeout(timeoutId);
|
|
4199
|
-
}
|
|
4200
|
-
if (err) self.emit("error", err, job);
|
|
4201
|
-
else if (didTimeout === false) {
|
|
4202
|
-
if (resultIndex !== null) self.results[resultIndex] = Array.prototype.slice.call(arguments, 1);
|
|
4203
|
-
self.emit("success", result, job);
|
|
4204
|
-
}
|
|
4205
|
-
if (self.session === session) {
|
|
4206
|
-
if (self.pending === 0 && self.jobs.length === 0) done.call(self);
|
|
4207
|
-
else if (self.running) self.start();
|
|
4208
|
-
}
|
|
4209
|
-
}
|
|
4210
|
-
}
|
|
4211
|
-
if (timeout) {
|
|
4212
|
-
timeoutId = setTimeout(function() {
|
|
4213
|
-
didTimeout = true;
|
|
4214
|
-
if (self.listeners("timeout").length > 0) self.emit("timeout", next, job);
|
|
4215
|
-
else next();
|
|
4216
|
-
}, timeout);
|
|
4217
|
-
this.timers[timeoutId] = timeoutId;
|
|
4218
|
-
}
|
|
4219
|
-
if (this.results) {
|
|
4220
|
-
resultIndex = this.results.length;
|
|
4221
|
-
this.results[resultIndex] = null;
|
|
4222
|
-
}
|
|
4223
|
-
this.pending++;
|
|
4224
|
-
self.emit("start", job);
|
|
4225
|
-
var promise = job(next);
|
|
4226
|
-
if (promise && promise.then && typeof promise.then === "function") promise.then(function(result) {
|
|
4227
|
-
return next(null, result);
|
|
4228
|
-
}).catch(function(err) {
|
|
4229
|
-
return next(err || true);
|
|
4230
|
-
});
|
|
4231
|
-
if (this.running && this.jobs.length > 0) this.start();
|
|
4232
|
-
};
|
|
4233
|
-
Queue.prototype.stop = function() {
|
|
4234
|
-
this.running = false;
|
|
4235
|
-
};
|
|
4236
|
-
Queue.prototype.end = function(err) {
|
|
4237
|
-
clearTimers.call(this);
|
|
4238
|
-
this.jobs.length = 0;
|
|
4239
|
-
this.pending = 0;
|
|
4240
|
-
done.call(this, err);
|
|
4241
|
-
};
|
|
4242
|
-
function clearTimers() {
|
|
4243
|
-
for (var key in this.timers) {
|
|
4244
|
-
var timeoutId = this.timers[key];
|
|
4245
|
-
delete this.timers[key];
|
|
4246
|
-
clearTimeout(timeoutId);
|
|
4247
|
-
}
|
|
4248
|
-
}
|
|
4249
|
-
function callOnErrorOrEnd(cb) {
|
|
4250
|
-
var self = this;
|
|
4251
|
-
this.on("error", onerror);
|
|
4252
|
-
this.on("end", onend);
|
|
4253
|
-
function onerror(err) {
|
|
4254
|
-
self.end(err);
|
|
4255
|
-
}
|
|
4256
|
-
function onend(err) {
|
|
4257
|
-
self.removeListener("error", onerror);
|
|
4258
|
-
self.removeListener("end", onend);
|
|
4259
|
-
cb(err, this.results);
|
|
4260
|
-
}
|
|
4261
|
-
}
|
|
4262
|
-
function done(err) {
|
|
4263
|
-
this.session++;
|
|
4264
|
-
this.running = false;
|
|
4265
|
-
this.emit("end", err);
|
|
4266
|
-
}
|
|
4267
|
-
}));
|
|
4268
|
-
//#endregion
|
|
4269
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/utils.js
|
|
4270
|
-
var require_utils = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
4271
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4272
|
-
exports.findBox = exports.readUInt = exports.readUInt32LE = exports.readUInt32BE = exports.readInt32LE = exports.readUInt24LE = exports.readUInt16LE = exports.readUInt16BE = exports.readInt16LE = exports.toHexString = exports.toUTF8String = void 0;
|
|
4273
|
-
const decoder = new TextDecoder();
|
|
4274
|
-
const toUTF8String = (input, start = 0, end = input.length) => decoder.decode(input.slice(start, end));
|
|
4275
|
-
exports.toUTF8String = toUTF8String;
|
|
4276
|
-
const toHexString = (input, start = 0, end = input.length) => input.slice(start, end).reduce((memo, i) => memo + ("0" + i.toString(16)).slice(-2), "");
|
|
4277
|
-
exports.toHexString = toHexString;
|
|
4278
|
-
const readInt16LE = (input, offset = 0) => {
|
|
4279
|
-
const val = input[offset] + input[offset + 1] * 2 ** 8;
|
|
4280
|
-
return val | (val & 2 ** 15) * 131070;
|
|
4281
|
-
};
|
|
4282
|
-
exports.readInt16LE = readInt16LE;
|
|
4283
|
-
const readUInt16BE = (input, offset = 0) => input[offset] * 2 ** 8 + input[offset + 1];
|
|
4284
|
-
exports.readUInt16BE = readUInt16BE;
|
|
4285
|
-
const readUInt16LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8;
|
|
4286
|
-
exports.readUInt16LE = readUInt16LE;
|
|
4287
|
-
const readUInt24LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8 + input[offset + 2] * 2 ** 16;
|
|
4288
|
-
exports.readUInt24LE = readUInt24LE;
|
|
4289
|
-
const readInt32LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8 + input[offset + 2] * 2 ** 16 + (input[offset + 3] << 24);
|
|
4290
|
-
exports.readInt32LE = readInt32LE;
|
|
4291
|
-
const readUInt32BE = (input, offset = 0) => input[offset] * 2 ** 24 + input[offset + 1] * 2 ** 16 + input[offset + 2] * 2 ** 8 + input[offset + 3];
|
|
4292
|
-
exports.readUInt32BE = readUInt32BE;
|
|
4293
|
-
const readUInt32LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8 + input[offset + 2] * 2 ** 16 + input[offset + 3] * 2 ** 24;
|
|
4294
|
-
exports.readUInt32LE = readUInt32LE;
|
|
4295
|
-
const methods = {
|
|
4296
|
-
readUInt16BE: exports.readUInt16BE,
|
|
4297
|
-
readUInt16LE: exports.readUInt16LE,
|
|
4298
|
-
readUInt32BE: exports.readUInt32BE,
|
|
4299
|
-
readUInt32LE: exports.readUInt32LE
|
|
4300
|
-
};
|
|
4301
|
-
function readUInt(input, bits, offset, isBigEndian) {
|
|
4302
|
-
offset = offset || 0;
|
|
4303
|
-
const endian = isBigEndian ? "BE" : "LE";
|
|
4304
|
-
const methodName = "readUInt" + bits + endian;
|
|
4305
|
-
return methods[methodName](input, offset);
|
|
4306
|
-
}
|
|
4307
|
-
exports.readUInt = readUInt;
|
|
4308
|
-
function readBox(input, offset) {
|
|
4309
|
-
if (input.length - offset < 4) return;
|
|
4310
|
-
const boxSize = (0, exports.readUInt32BE)(input, offset);
|
|
4311
|
-
if (input.length - offset < boxSize) return;
|
|
4312
|
-
return {
|
|
4313
|
-
name: (0, exports.toUTF8String)(input, 4 + offset, 8 + offset),
|
|
4314
|
-
offset,
|
|
4315
|
-
size: boxSize
|
|
4316
|
-
};
|
|
4317
|
-
}
|
|
4318
|
-
function findBox(input, boxName, offset) {
|
|
4319
|
-
while (offset < input.length) {
|
|
4320
|
-
const box = readBox(input, offset);
|
|
4321
|
-
if (!box) break;
|
|
4322
|
-
if (box.name === boxName) return box;
|
|
4323
|
-
offset += box.size > 0 ? box.size : 8;
|
|
4324
|
-
}
|
|
4325
|
-
}
|
|
4326
|
-
exports.findBox = findBox;
|
|
4327
|
-
}));
|
|
4328
|
-
//#endregion
|
|
4329
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/bmp.js
|
|
4330
|
-
var require_bmp = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
4331
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4332
|
-
exports.BMP = void 0;
|
|
4333
|
-
const utils_1 = require_utils();
|
|
4334
|
-
exports.BMP = {
|
|
4335
|
-
validate: (input) => (0, utils_1.toUTF8String)(input, 0, 2) === "BM",
|
|
4336
|
-
calculate: (input) => ({
|
|
4337
|
-
height: Math.abs((0, utils_1.readInt32LE)(input, 22)),
|
|
4338
|
-
width: (0, utils_1.readUInt32LE)(input, 18)
|
|
4339
|
-
})
|
|
4340
|
-
};
|
|
4341
|
-
}));
|
|
4342
|
-
//#endregion
|
|
4343
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/ico.js
|
|
4344
|
-
var require_ico = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
4345
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4346
|
-
exports.ICO = void 0;
|
|
4347
|
-
const utils_1 = require_utils();
|
|
4348
|
-
const TYPE_ICON = 1;
|
|
4349
|
-
/**
|
|
4350
|
-
* ICON Header
|
|
4351
|
-
*
|
|
4352
|
-
* | Offset | Size | Purpose |
|
|
4353
|
-
* | 0 | 2 | Reserved. Must always be 0. |
|
|
4354
|
-
* | 2 | 2 | Image type: 1 for icon (.ICO) image, 2 for cursor (.CUR) image. Other values are invalid. |
|
|
4355
|
-
* | 4 | 2 | Number of images in the file. |
|
|
4356
|
-
*
|
|
4357
|
-
*/
|
|
4358
|
-
const SIZE_HEADER = 6;
|
|
4359
|
-
/**
|
|
4360
|
-
* Image Entry
|
|
4361
|
-
*
|
|
4362
|
-
* | Offset | Size | Purpose |
|
|
4363
|
-
* | 0 | 1 | Image width in pixels. Can be any number between 0 and 255. Value 0 means width is 256 pixels. |
|
|
4364
|
-
* | 1 | 1 | Image height in pixels. Can be any number between 0 and 255. Value 0 means height is 256 pixels. |
|
|
4365
|
-
* | 2 | 1 | Number of colors in the color palette. Should be 0 if the image does not use a color palette. |
|
|
4366
|
-
* | 3 | 1 | Reserved. Should be 0. |
|
|
4367
|
-
* | 4 | 2 | ICO format: Color planes. Should be 0 or 1. |
|
|
4368
|
-
* | | | CUR format: The horizontal coordinates of the hotspot in number of pixels from the left. |
|
|
4369
|
-
* | 6 | 2 | ICO format: Bits per pixel. |
|
|
4370
|
-
* | | | CUR format: The vertical coordinates of the hotspot in number of pixels from the top. |
|
|
4371
|
-
* | 8 | 4 | The size of the image's data in bytes |
|
|
4372
|
-
* | 12 | 4 | The offset of BMP or PNG data from the beginning of the ICO/CUR file |
|
|
4373
|
-
*
|
|
4374
|
-
*/
|
|
4375
|
-
const SIZE_IMAGE_ENTRY = 16;
|
|
4376
|
-
function getSizeFromOffset(input, offset) {
|
|
4377
|
-
const value = input[offset];
|
|
4378
|
-
return value === 0 ? 256 : value;
|
|
4379
|
-
}
|
|
4380
|
-
function getImageSize(input, imageIndex) {
|
|
4381
|
-
const offset = SIZE_HEADER + imageIndex * SIZE_IMAGE_ENTRY;
|
|
4382
|
-
return {
|
|
4383
|
-
height: getSizeFromOffset(input, offset + 1),
|
|
4384
|
-
width: getSizeFromOffset(input, offset)
|
|
4385
|
-
};
|
|
4386
|
-
}
|
|
4387
|
-
exports.ICO = {
|
|
4388
|
-
validate(input) {
|
|
4389
|
-
const reserved = (0, utils_1.readUInt16LE)(input, 0);
|
|
4390
|
-
const imageCount = (0, utils_1.readUInt16LE)(input, 4);
|
|
4391
|
-
if (reserved !== 0 || imageCount === 0) return false;
|
|
4392
|
-
return (0, utils_1.readUInt16LE)(input, 2) === TYPE_ICON;
|
|
4393
|
-
},
|
|
4394
|
-
calculate(input) {
|
|
4395
|
-
const nbImages = (0, utils_1.readUInt16LE)(input, 4);
|
|
4396
|
-
const imageSize = getImageSize(input, 0);
|
|
4397
|
-
if (nbImages === 1) return imageSize;
|
|
4398
|
-
const imgs = [imageSize];
|
|
4399
|
-
for (let imageIndex = 1; imageIndex < nbImages; imageIndex += 1) imgs.push(getImageSize(input, imageIndex));
|
|
4400
|
-
return {
|
|
4401
|
-
height: imageSize.height,
|
|
4402
|
-
images: imgs,
|
|
4403
|
-
width: imageSize.width
|
|
4404
|
-
};
|
|
4405
|
-
}
|
|
4406
|
-
};
|
|
4407
|
-
}));
|
|
4408
|
-
//#endregion
|
|
4409
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/cur.js
|
|
4410
|
-
var require_cur = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
4411
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4412
|
-
exports.CUR = void 0;
|
|
4413
|
-
const ico_1 = require_ico();
|
|
4414
|
-
const utils_1 = require_utils();
|
|
4415
|
-
const TYPE_CURSOR = 2;
|
|
4416
|
-
exports.CUR = {
|
|
4417
|
-
validate(input) {
|
|
4418
|
-
const reserved = (0, utils_1.readUInt16LE)(input, 0);
|
|
4419
|
-
const imageCount = (0, utils_1.readUInt16LE)(input, 4);
|
|
4420
|
-
if (reserved !== 0 || imageCount === 0) return false;
|
|
4421
|
-
return (0, utils_1.readUInt16LE)(input, 2) === TYPE_CURSOR;
|
|
4422
|
-
},
|
|
4423
|
-
calculate: (input) => ico_1.ICO.calculate(input)
|
|
4424
|
-
};
|
|
4425
|
-
}));
|
|
4426
|
-
//#endregion
|
|
4427
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/dds.js
|
|
4428
|
-
var require_dds = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
4429
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4430
|
-
exports.DDS = void 0;
|
|
4431
|
-
const utils_1 = require_utils();
|
|
4432
|
-
exports.DDS = {
|
|
4433
|
-
validate: (input) => (0, utils_1.readUInt32LE)(input, 0) === 542327876,
|
|
4434
|
-
calculate: (input) => ({
|
|
4435
|
-
height: (0, utils_1.readUInt32LE)(input, 12),
|
|
4436
|
-
width: (0, utils_1.readUInt32LE)(input, 16)
|
|
4437
|
-
})
|
|
4438
|
-
};
|
|
4439
|
-
}));
|
|
4440
|
-
//#endregion
|
|
4441
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/gif.js
|
|
4442
|
-
var require_gif = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
4443
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4444
|
-
exports.GIF = void 0;
|
|
4445
|
-
const utils_1 = require_utils();
|
|
4446
|
-
const gifRegexp = /^GIF8[79]a/;
|
|
4447
|
-
exports.GIF = {
|
|
4448
|
-
validate: (input) => gifRegexp.test((0, utils_1.toUTF8String)(input, 0, 6)),
|
|
4449
|
-
calculate: (input) => ({
|
|
4450
|
-
height: (0, utils_1.readUInt16LE)(input, 8),
|
|
4451
|
-
width: (0, utils_1.readUInt16LE)(input, 6)
|
|
4452
|
-
})
|
|
4453
|
-
};
|
|
4454
|
-
}));
|
|
4455
|
-
//#endregion
|
|
4456
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/heif.js
|
|
4457
|
-
var require_heif = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
4458
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4459
|
-
exports.HEIF = void 0;
|
|
4460
|
-
const utils_1 = require_utils();
|
|
4461
|
-
const brandMap = {
|
|
4462
|
-
avif: "avif",
|
|
4463
|
-
mif1: "heif",
|
|
4464
|
-
msf1: "heif",
|
|
4465
|
-
heic: "heic",
|
|
4466
|
-
heix: "heic",
|
|
4467
|
-
hevc: "heic",
|
|
4468
|
-
hevx: "heic"
|
|
4469
|
-
};
|
|
4470
|
-
exports.HEIF = {
|
|
4471
|
-
validate(input) {
|
|
4472
|
-
if ((0, utils_1.toUTF8String)(input, 4, 8) !== "ftyp") return false;
|
|
4473
|
-
const ftypBox = (0, utils_1.findBox)(input, "ftyp", 0);
|
|
4474
|
-
if (!ftypBox) return false;
|
|
4475
|
-
return (0, utils_1.toUTF8String)(input, ftypBox.offset + 8, ftypBox.offset + 12) in brandMap;
|
|
4476
|
-
},
|
|
4477
|
-
calculate(input) {
|
|
4478
|
-
const metaBox = (0, utils_1.findBox)(input, "meta", 0);
|
|
4479
|
-
const iprpBox = metaBox && (0, utils_1.findBox)(input, "iprp", metaBox.offset + 12);
|
|
4480
|
-
const ipcoBox = iprpBox && (0, utils_1.findBox)(input, "ipco", iprpBox.offset + 8);
|
|
4481
|
-
const ispeBox = ipcoBox && (0, utils_1.findBox)(input, "ispe", ipcoBox.offset + 8);
|
|
4482
|
-
if (ispeBox) return {
|
|
4483
|
-
height: (0, utils_1.readUInt32BE)(input, ispeBox.offset + 16),
|
|
4484
|
-
width: (0, utils_1.readUInt32BE)(input, ispeBox.offset + 12),
|
|
4485
|
-
type: (0, utils_1.toUTF8String)(input, 8, 12)
|
|
4486
|
-
};
|
|
4487
|
-
throw new TypeError("Invalid HEIF, no size found");
|
|
4488
|
-
}
|
|
4489
|
-
};
|
|
4490
|
-
}));
|
|
4491
|
-
//#endregion
|
|
4492
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/icns.js
|
|
4493
|
-
var require_icns = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
4494
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4495
|
-
exports.ICNS = void 0;
|
|
4496
|
-
const utils_1 = require_utils();
|
|
4497
|
-
/**
|
|
4498
|
-
* ICNS Header
|
|
4499
|
-
*
|
|
4500
|
-
* | Offset | Size | Purpose |
|
|
4501
|
-
* | 0 | 4 | Magic literal, must be "icns" (0x69, 0x63, 0x6e, 0x73) |
|
|
4502
|
-
* | 4 | 4 | Length of file, in bytes, msb first. |
|
|
4503
|
-
*
|
|
4504
|
-
*/
|
|
4505
|
-
const SIZE_HEADER = 8;
|
|
4506
|
-
const FILE_LENGTH_OFFSET = 4;
|
|
4507
|
-
/**
|
|
4508
|
-
* Image Entry
|
|
4509
|
-
*
|
|
4510
|
-
* | Offset | Size | Purpose |
|
|
4511
|
-
* | 0 | 4 | Icon type, see OSType below. |
|
|
4512
|
-
* | 4 | 4 | Length of data, in bytes (including type and length), msb first. |
|
|
4513
|
-
* | 8 | n | Icon data |
|
|
4514
|
-
*/
|
|
4515
|
-
const ENTRY_LENGTH_OFFSET = 4;
|
|
4516
|
-
const ICON_TYPE_SIZE = {
|
|
4517
|
-
ICON: 32,
|
|
4518
|
-
"ICN#": 32,
|
|
4519
|
-
"icm#": 16,
|
|
4520
|
-
icm4: 16,
|
|
4521
|
-
icm8: 16,
|
|
4522
|
-
"ics#": 16,
|
|
4523
|
-
ics4: 16,
|
|
4524
|
-
ics8: 16,
|
|
4525
|
-
is32: 16,
|
|
4526
|
-
s8mk: 16,
|
|
4527
|
-
icp4: 16,
|
|
4528
|
-
icl4: 32,
|
|
4529
|
-
icl8: 32,
|
|
4530
|
-
il32: 32,
|
|
4531
|
-
l8mk: 32,
|
|
4532
|
-
icp5: 32,
|
|
4533
|
-
ic11: 32,
|
|
4534
|
-
ich4: 48,
|
|
4535
|
-
ich8: 48,
|
|
4536
|
-
ih32: 48,
|
|
4537
|
-
h8mk: 48,
|
|
4538
|
-
icp6: 64,
|
|
4539
|
-
ic12: 32,
|
|
4540
|
-
it32: 128,
|
|
4541
|
-
t8mk: 128,
|
|
4542
|
-
ic07: 128,
|
|
4543
|
-
ic08: 256,
|
|
4544
|
-
ic13: 256,
|
|
4545
|
-
ic09: 512,
|
|
4546
|
-
ic14: 512,
|
|
4547
|
-
ic10: 1024
|
|
4548
|
-
};
|
|
4549
|
-
function readImageHeader(input, imageOffset) {
|
|
4550
|
-
const imageLengthOffset = imageOffset + ENTRY_LENGTH_OFFSET;
|
|
4551
|
-
return [(0, utils_1.toUTF8String)(input, imageOffset, imageLengthOffset), (0, utils_1.readUInt32BE)(input, imageLengthOffset)];
|
|
4552
|
-
}
|
|
4553
|
-
function getImageSize(type) {
|
|
4554
|
-
const size = ICON_TYPE_SIZE[type];
|
|
4555
|
-
return {
|
|
4556
|
-
width: size,
|
|
4557
|
-
height: size,
|
|
4558
|
-
type
|
|
4559
|
-
};
|
|
4560
|
-
}
|
|
4561
|
-
exports.ICNS = {
|
|
4562
|
-
validate: (input) => (0, utils_1.toUTF8String)(input, 0, 4) === "icns",
|
|
4563
|
-
calculate(input) {
|
|
4564
|
-
const inputLength = input.length;
|
|
4565
|
-
const fileLength = (0, utils_1.readUInt32BE)(input, FILE_LENGTH_OFFSET);
|
|
4566
|
-
let imageOffset = SIZE_HEADER;
|
|
4567
|
-
let imageHeader = readImageHeader(input, imageOffset);
|
|
4568
|
-
let imageSize = getImageSize(imageHeader[0]);
|
|
4569
|
-
imageOffset += imageHeader[1];
|
|
4570
|
-
if (imageOffset === fileLength) return imageSize;
|
|
4571
|
-
const result = {
|
|
4572
|
-
height: imageSize.height,
|
|
4573
|
-
images: [imageSize],
|
|
4574
|
-
width: imageSize.width
|
|
4575
|
-
};
|
|
4576
|
-
while (imageOffset < fileLength && imageOffset < inputLength) {
|
|
4577
|
-
imageHeader = readImageHeader(input, imageOffset);
|
|
4578
|
-
imageSize = getImageSize(imageHeader[0]);
|
|
4579
|
-
imageOffset += imageHeader[1];
|
|
4580
|
-
result.images.push(imageSize);
|
|
4581
|
-
}
|
|
4582
|
-
return result;
|
|
4583
|
-
}
|
|
4584
|
-
};
|
|
4585
|
-
}));
|
|
4586
|
-
//#endregion
|
|
4587
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/j2c.js
|
|
4588
|
-
var require_j2c = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
4589
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4590
|
-
exports.J2C = void 0;
|
|
4591
|
-
const utils_1 = require_utils();
|
|
4592
|
-
exports.J2C = {
|
|
4593
|
-
validate: (input) => (0, utils_1.readUInt32BE)(input, 0) === 4283432785,
|
|
4594
|
-
calculate: (input) => ({
|
|
4595
|
-
height: (0, utils_1.readUInt32BE)(input, 12),
|
|
4596
|
-
width: (0, utils_1.readUInt32BE)(input, 8)
|
|
4597
|
-
})
|
|
4598
|
-
};
|
|
4599
|
-
}));
|
|
4600
|
-
//#endregion
|
|
4601
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/jp2.js
|
|
4602
|
-
var require_jp2 = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
4603
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4604
|
-
exports.JP2 = void 0;
|
|
4605
|
-
const utils_1 = require_utils();
|
|
4606
|
-
exports.JP2 = {
|
|
4607
|
-
validate(input) {
|
|
4608
|
-
if ((0, utils_1.toUTF8String)(input, 4, 8) !== "jP ") return false;
|
|
4609
|
-
const ftypBox = (0, utils_1.findBox)(input, "ftyp", 0);
|
|
4610
|
-
if (!ftypBox) return false;
|
|
4611
|
-
return (0, utils_1.toUTF8String)(input, ftypBox.offset + 8, ftypBox.offset + 12) === "jp2 ";
|
|
4612
|
-
},
|
|
4613
|
-
calculate(input) {
|
|
4614
|
-
const jp2hBox = (0, utils_1.findBox)(input, "jp2h", 0);
|
|
4615
|
-
const ihdrBox = jp2hBox && (0, utils_1.findBox)(input, "ihdr", jp2hBox.offset + 8);
|
|
4616
|
-
if (ihdrBox) return {
|
|
4617
|
-
height: (0, utils_1.readUInt32BE)(input, ihdrBox.offset + 8),
|
|
4618
|
-
width: (0, utils_1.readUInt32BE)(input, ihdrBox.offset + 12)
|
|
4619
|
-
};
|
|
4620
|
-
throw new TypeError("Unsupported JPEG 2000 format");
|
|
4621
|
-
}
|
|
4622
|
-
};
|
|
4623
|
-
}));
|
|
4624
|
-
//#endregion
|
|
4625
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/jpg.js
|
|
4626
|
-
var require_jpg = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
4627
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4628
|
-
exports.JPG = void 0;
|
|
4629
|
-
const utils_1 = require_utils();
|
|
4630
|
-
const EXIF_MARKER = "45786966";
|
|
4631
|
-
const APP1_DATA_SIZE_BYTES = 2;
|
|
4632
|
-
const EXIF_HEADER_BYTES = 6;
|
|
4633
|
-
const BIG_ENDIAN_BYTE_ALIGN = "4d4d";
|
|
4634
|
-
const LITTLE_ENDIAN_BYTE_ALIGN = "4949";
|
|
4635
|
-
const IDF_ENTRY_BYTES = 12;
|
|
4636
|
-
function isEXIF(input) {
|
|
4637
|
-
return (0, utils_1.toHexString)(input, 2, 6) === EXIF_MARKER;
|
|
4638
|
-
}
|
|
4639
|
-
function extractSize(input, index) {
|
|
4640
|
-
return {
|
|
4641
|
-
height: (0, utils_1.readUInt16BE)(input, index),
|
|
4642
|
-
width: (0, utils_1.readUInt16BE)(input, index + 2)
|
|
4643
|
-
};
|
|
4644
|
-
}
|
|
4645
|
-
function extractOrientation(exifBlock, isBigEndian) {
|
|
4646
|
-
const idfDirectoryEntries = (0, utils_1.readUInt)(exifBlock, 16, 14, isBigEndian);
|
|
4647
|
-
for (let directoryEntryNumber = 0; directoryEntryNumber < idfDirectoryEntries; directoryEntryNumber++) {
|
|
4648
|
-
const start = 16 + directoryEntryNumber * IDF_ENTRY_BYTES;
|
|
4649
|
-
const end = start + IDF_ENTRY_BYTES;
|
|
4650
|
-
if (start > exifBlock.length) return;
|
|
4651
|
-
const block = exifBlock.slice(start, end);
|
|
4652
|
-
if ((0, utils_1.readUInt)(block, 16, 0, isBigEndian) === 274) {
|
|
4653
|
-
if ((0, utils_1.readUInt)(block, 16, 2, isBigEndian) !== 3) return;
|
|
4654
|
-
if ((0, utils_1.readUInt)(block, 32, 4, isBigEndian) !== 1) return;
|
|
4655
|
-
return (0, utils_1.readUInt)(block, 16, 8, isBigEndian);
|
|
4656
|
-
}
|
|
4657
|
-
}
|
|
4658
|
-
}
|
|
4659
|
-
function validateExifBlock(input, index) {
|
|
4660
|
-
const exifBlock = input.slice(APP1_DATA_SIZE_BYTES, index);
|
|
4661
|
-
const byteAlign = (0, utils_1.toHexString)(exifBlock, EXIF_HEADER_BYTES, 8);
|
|
4662
|
-
const isBigEndian = byteAlign === BIG_ENDIAN_BYTE_ALIGN;
|
|
4663
|
-
if (isBigEndian || byteAlign === LITTLE_ENDIAN_BYTE_ALIGN) return extractOrientation(exifBlock, isBigEndian);
|
|
4664
|
-
}
|
|
4665
|
-
function validateInput(input, index) {
|
|
4666
|
-
if (index > input.length) throw new TypeError("Corrupt JPG, exceeded buffer limits");
|
|
4667
|
-
}
|
|
4668
|
-
exports.JPG = {
|
|
4669
|
-
validate: (input) => (0, utils_1.toHexString)(input, 0, 2) === "ffd8",
|
|
4670
|
-
calculate(input) {
|
|
4671
|
-
input = input.slice(4);
|
|
4672
|
-
let orientation;
|
|
4673
|
-
let next;
|
|
4674
|
-
while (input.length) {
|
|
4675
|
-
const i = (0, utils_1.readUInt16BE)(input, 0);
|
|
4676
|
-
if (input[i] !== 255) {
|
|
4677
|
-
input = input.slice(1);
|
|
4678
|
-
continue;
|
|
4679
|
-
}
|
|
4680
|
-
if (isEXIF(input)) orientation = validateExifBlock(input, i);
|
|
4681
|
-
validateInput(input, i);
|
|
4682
|
-
next = input[i + 1];
|
|
4683
|
-
if (next === 192 || next === 193 || next === 194) {
|
|
4684
|
-
const size = extractSize(input, i + 5);
|
|
4685
|
-
if (!orientation) return size;
|
|
4686
|
-
return {
|
|
4687
|
-
height: size.height,
|
|
4688
|
-
orientation,
|
|
4689
|
-
width: size.width
|
|
4690
|
-
};
|
|
4691
|
-
}
|
|
4692
|
-
input = input.slice(i + 2);
|
|
4693
|
-
}
|
|
4694
|
-
throw new TypeError("Invalid JPG, no size found");
|
|
4695
|
-
}
|
|
4696
|
-
};
|
|
4697
|
-
}));
|
|
4698
|
-
//#endregion
|
|
4699
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/utils/bit-reader.js
|
|
4700
|
-
var require_bit_reader = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
4701
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4702
|
-
exports.BitReader = void 0;
|
|
4703
|
-
/** This class helps read Uint8Array bit-by-bit */
|
|
4704
|
-
var BitReader = class {
|
|
4705
|
-
constructor(input, endianness) {
|
|
4706
|
-
this.input = input;
|
|
4707
|
-
this.endianness = endianness;
|
|
4708
|
-
this.byteOffset = 2;
|
|
4709
|
-
this.bitOffset = 0;
|
|
4710
|
-
}
|
|
4711
|
-
/** Reads a specified number of bits, and move the offset */
|
|
4712
|
-
getBits(length = 1) {
|
|
4713
|
-
let result = 0;
|
|
4714
|
-
let bitsRead = 0;
|
|
4715
|
-
while (bitsRead < length) {
|
|
4716
|
-
if (this.byteOffset >= this.input.length) throw new Error("Reached end of input");
|
|
4717
|
-
const currentByte = this.input[this.byteOffset];
|
|
4718
|
-
const bitsLeft = 8 - this.bitOffset;
|
|
4719
|
-
const bitsToRead = Math.min(length - bitsRead, bitsLeft);
|
|
4720
|
-
if (this.endianness === "little-endian") {
|
|
4721
|
-
const mask = (1 << bitsToRead) - 1;
|
|
4722
|
-
const bits = currentByte >> this.bitOffset & mask;
|
|
4723
|
-
result |= bits << bitsRead;
|
|
4724
|
-
} else {
|
|
4725
|
-
const bits = (currentByte & (1 << bitsToRead) - 1 << 8 - this.bitOffset - bitsToRead) >> 8 - this.bitOffset - bitsToRead;
|
|
4726
|
-
result = result << bitsToRead | bits;
|
|
4727
|
-
}
|
|
4728
|
-
bitsRead += bitsToRead;
|
|
4729
|
-
this.bitOffset += bitsToRead;
|
|
4730
|
-
if (this.bitOffset === 8) {
|
|
4731
|
-
this.byteOffset++;
|
|
4732
|
-
this.bitOffset = 0;
|
|
4733
|
-
}
|
|
4734
|
-
}
|
|
4735
|
-
return result;
|
|
4736
|
-
}
|
|
4737
|
-
};
|
|
4738
|
-
exports.BitReader = BitReader;
|
|
4739
|
-
}));
|
|
4740
|
-
//#endregion
|
|
4741
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/jxl-stream.js
|
|
4742
|
-
var require_jxl_stream = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
4743
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4744
|
-
exports.JXLStream = void 0;
|
|
4745
|
-
const utils_1 = require_utils();
|
|
4746
|
-
const bit_reader_1 = require_bit_reader();
|
|
4747
|
-
function calculateImageDimension(reader, isSmallImage) {
|
|
4748
|
-
if (isSmallImage) return 8 * (1 + reader.getBits(5));
|
|
4749
|
-
else {
|
|
4750
|
-
const extraBits = [
|
|
4751
|
-
9,
|
|
4752
|
-
13,
|
|
4753
|
-
18,
|
|
4754
|
-
30
|
|
4755
|
-
][reader.getBits(2)];
|
|
4756
|
-
return 1 + reader.getBits(extraBits);
|
|
4757
|
-
}
|
|
4758
|
-
}
|
|
4759
|
-
function calculateImageWidth(reader, isSmallImage, widthMode, height) {
|
|
4760
|
-
if (isSmallImage && widthMode === 0) return 8 * (1 + reader.getBits(5));
|
|
4761
|
-
else if (widthMode === 0) return calculateImageDimension(reader, false);
|
|
4762
|
-
else return Math.floor(height * [
|
|
4763
|
-
1,
|
|
4764
|
-
1.2,
|
|
4765
|
-
4 / 3,
|
|
4766
|
-
1.5,
|
|
4767
|
-
16 / 9,
|
|
4768
|
-
5 / 4,
|
|
4769
|
-
2
|
|
4770
|
-
][widthMode - 1]);
|
|
4771
|
-
}
|
|
4772
|
-
exports.JXLStream = {
|
|
4773
|
-
validate: (input) => {
|
|
4774
|
-
return (0, utils_1.toHexString)(input, 0, 2) === "ff0a";
|
|
4775
|
-
},
|
|
4776
|
-
calculate(input) {
|
|
4777
|
-
const reader = new bit_reader_1.BitReader(input, "little-endian");
|
|
4778
|
-
const isSmallImage = reader.getBits(1) === 1;
|
|
4779
|
-
const height = calculateImageDimension(reader, isSmallImage);
|
|
4780
|
-
return {
|
|
4781
|
-
width: calculateImageWidth(reader, isSmallImage, reader.getBits(3), height),
|
|
4782
|
-
height
|
|
4783
|
-
};
|
|
4784
|
-
}
|
|
4785
|
-
};
|
|
4786
|
-
}));
|
|
4787
|
-
//#endregion
|
|
4788
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/jxl.js
|
|
4789
|
-
var require_jxl = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
4790
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4791
|
-
exports.JXL = void 0;
|
|
4792
|
-
const utils_1 = require_utils();
|
|
4793
|
-
const jxl_stream_1 = require_jxl_stream();
|
|
4794
|
-
/** Extracts the codestream from a containerized JPEG XL image */
|
|
4795
|
-
function extractCodestream(input) {
|
|
4796
|
-
const jxlcBox = (0, utils_1.findBox)(input, "jxlc", 0);
|
|
4797
|
-
if (jxlcBox) return input.slice(jxlcBox.offset + 8, jxlcBox.offset + jxlcBox.size);
|
|
4798
|
-
const partialStreams = extractPartialStreams(input);
|
|
4799
|
-
if (partialStreams.length > 0) return concatenateCodestreams(partialStreams);
|
|
4800
|
-
}
|
|
4801
|
-
/** Extracts partial codestreams from jxlp boxes */
|
|
4802
|
-
function extractPartialStreams(input) {
|
|
4803
|
-
const partialStreams = [];
|
|
4804
|
-
let offset = 0;
|
|
4805
|
-
while (offset < input.length) {
|
|
4806
|
-
const jxlpBox = (0, utils_1.findBox)(input, "jxlp", offset);
|
|
4807
|
-
if (!jxlpBox) break;
|
|
4808
|
-
partialStreams.push(input.slice(jxlpBox.offset + 12, jxlpBox.offset + jxlpBox.size));
|
|
4809
|
-
offset = jxlpBox.offset + jxlpBox.size;
|
|
4810
|
-
}
|
|
4811
|
-
return partialStreams;
|
|
4812
|
-
}
|
|
4813
|
-
/** Concatenates partial codestreams into a single codestream */
|
|
4814
|
-
function concatenateCodestreams(partialCodestreams) {
|
|
4815
|
-
const totalLength = partialCodestreams.reduce((acc, curr) => acc + curr.length, 0);
|
|
4816
|
-
const codestream = new Uint8Array(totalLength);
|
|
4817
|
-
let position = 0;
|
|
4818
|
-
for (const partial of partialCodestreams) {
|
|
4819
|
-
codestream.set(partial, position);
|
|
4820
|
-
position += partial.length;
|
|
4821
|
-
}
|
|
4822
|
-
return codestream;
|
|
4823
|
-
}
|
|
4824
|
-
exports.JXL = {
|
|
4825
|
-
validate: (input) => {
|
|
4826
|
-
if ((0, utils_1.toUTF8String)(input, 4, 8) !== "JXL ") return false;
|
|
4827
|
-
const ftypBox = (0, utils_1.findBox)(input, "ftyp", 0);
|
|
4828
|
-
if (!ftypBox) return false;
|
|
4829
|
-
return (0, utils_1.toUTF8String)(input, ftypBox.offset + 8, ftypBox.offset + 12) === "jxl ";
|
|
4830
|
-
},
|
|
4831
|
-
calculate(input) {
|
|
4832
|
-
const codestream = extractCodestream(input);
|
|
4833
|
-
if (codestream) return jxl_stream_1.JXLStream.calculate(codestream);
|
|
4834
|
-
throw new Error("No codestream found in JXL container");
|
|
4835
|
-
}
|
|
4836
|
-
};
|
|
4837
|
-
}));
|
|
4838
|
-
//#endregion
|
|
4839
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/ktx.js
|
|
4840
|
-
var require_ktx = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
4841
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4842
|
-
exports.KTX = void 0;
|
|
4843
|
-
const utils_1 = require_utils();
|
|
4844
|
-
exports.KTX = {
|
|
4845
|
-
validate: (input) => {
|
|
4846
|
-
const signature = (0, utils_1.toUTF8String)(input, 1, 7);
|
|
4847
|
-
return ["KTX 11", "KTX 20"].includes(signature);
|
|
4848
|
-
},
|
|
4849
|
-
calculate: (input) => {
|
|
4850
|
-
const type = input[5] === 49 ? "ktx" : "ktx2";
|
|
4851
|
-
const offset = type === "ktx" ? 36 : 20;
|
|
4852
|
-
return {
|
|
4853
|
-
height: (0, utils_1.readUInt32LE)(input, offset + 4),
|
|
4854
|
-
width: (0, utils_1.readUInt32LE)(input, offset),
|
|
4855
|
-
type
|
|
4856
|
-
};
|
|
4857
|
-
}
|
|
4858
|
-
};
|
|
4859
|
-
}));
|
|
4860
|
-
//#endregion
|
|
4861
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/png.js
|
|
4862
|
-
var require_png = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
4863
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4864
|
-
exports.PNG = void 0;
|
|
4865
|
-
const utils_1 = require_utils();
|
|
4866
|
-
const pngSignature = "PNG\r\n\n";
|
|
4867
|
-
const pngImageHeaderChunkName = "IHDR";
|
|
4868
|
-
const pngFriedChunkName = "CgBI";
|
|
4869
|
-
exports.PNG = {
|
|
4870
|
-
validate(input) {
|
|
4871
|
-
if (pngSignature === (0, utils_1.toUTF8String)(input, 1, 8)) {
|
|
4872
|
-
let chunkName = (0, utils_1.toUTF8String)(input, 12, 16);
|
|
4873
|
-
if (chunkName === pngFriedChunkName) chunkName = (0, utils_1.toUTF8String)(input, 28, 32);
|
|
4874
|
-
if (chunkName !== pngImageHeaderChunkName) throw new TypeError("Invalid PNG");
|
|
4875
|
-
return true;
|
|
4876
|
-
}
|
|
4877
|
-
return false;
|
|
4878
|
-
},
|
|
4879
|
-
calculate(input) {
|
|
4880
|
-
if ((0, utils_1.toUTF8String)(input, 12, 16) === pngFriedChunkName) return {
|
|
4881
|
-
height: (0, utils_1.readUInt32BE)(input, 36),
|
|
4882
|
-
width: (0, utils_1.readUInt32BE)(input, 32)
|
|
4883
|
-
};
|
|
4884
|
-
return {
|
|
4885
|
-
height: (0, utils_1.readUInt32BE)(input, 20),
|
|
4886
|
-
width: (0, utils_1.readUInt32BE)(input, 16)
|
|
4887
|
-
};
|
|
4888
|
-
}
|
|
4889
|
-
};
|
|
4890
|
-
}));
|
|
4891
|
-
//#endregion
|
|
4892
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/pnm.js
|
|
4893
|
-
var require_pnm = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
4894
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4895
|
-
exports.PNM = void 0;
|
|
4896
|
-
const utils_1 = require_utils();
|
|
4897
|
-
const PNMTypes = {
|
|
4898
|
-
P1: "pbm/ascii",
|
|
4899
|
-
P2: "pgm/ascii",
|
|
4900
|
-
P3: "ppm/ascii",
|
|
4901
|
-
P4: "pbm",
|
|
4902
|
-
P5: "pgm",
|
|
4903
|
-
P6: "ppm",
|
|
4904
|
-
P7: "pam",
|
|
4905
|
-
PF: "pfm"
|
|
4906
|
-
};
|
|
4907
|
-
const handlers = {
|
|
4908
|
-
default: (lines) => {
|
|
4909
|
-
let dimensions = [];
|
|
4910
|
-
while (lines.length > 0) {
|
|
4911
|
-
const line = lines.shift();
|
|
4912
|
-
if (line[0] === "#") continue;
|
|
4913
|
-
dimensions = line.split(" ");
|
|
4914
|
-
break;
|
|
4915
|
-
}
|
|
4916
|
-
if (dimensions.length === 2) return {
|
|
4917
|
-
height: parseInt(dimensions[1], 10),
|
|
4918
|
-
width: parseInt(dimensions[0], 10)
|
|
4919
|
-
};
|
|
4920
|
-
else throw new TypeError("Invalid PNM");
|
|
4921
|
-
},
|
|
4922
|
-
pam: (lines) => {
|
|
4923
|
-
const size = {};
|
|
4924
|
-
while (lines.length > 0) {
|
|
4925
|
-
const line = lines.shift();
|
|
4926
|
-
if (line.length > 16 || line.charCodeAt(0) > 128) continue;
|
|
4927
|
-
const [key, value] = line.split(" ");
|
|
4928
|
-
if (key && value) size[key.toLowerCase()] = parseInt(value, 10);
|
|
4929
|
-
if (size.height && size.width) break;
|
|
4930
|
-
}
|
|
4931
|
-
if (size.height && size.width) return {
|
|
4932
|
-
height: size.height,
|
|
4933
|
-
width: size.width
|
|
4934
|
-
};
|
|
4935
|
-
else throw new TypeError("Invalid PAM");
|
|
4936
|
-
}
|
|
4937
|
-
};
|
|
4938
|
-
exports.PNM = {
|
|
4939
|
-
validate: (input) => (0, utils_1.toUTF8String)(input, 0, 2) in PNMTypes,
|
|
4940
|
-
calculate(input) {
|
|
4941
|
-
const signature = (0, utils_1.toUTF8String)(input, 0, 2);
|
|
4942
|
-
const type = PNMTypes[signature];
|
|
4943
|
-
const lines = (0, utils_1.toUTF8String)(input, 3).split(/[\r\n]+/);
|
|
4944
|
-
return (handlers[type] || handlers.default)(lines);
|
|
4945
|
-
}
|
|
4946
|
-
};
|
|
4947
|
-
}));
|
|
4948
|
-
//#endregion
|
|
4949
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/psd.js
|
|
4950
|
-
var require_psd = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
4951
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4952
|
-
exports.PSD = void 0;
|
|
4953
|
-
const utils_1 = require_utils();
|
|
4954
|
-
exports.PSD = {
|
|
4955
|
-
validate: (input) => (0, utils_1.toUTF8String)(input, 0, 4) === "8BPS",
|
|
4956
|
-
calculate: (input) => ({
|
|
4957
|
-
height: (0, utils_1.readUInt32BE)(input, 14),
|
|
4958
|
-
width: (0, utils_1.readUInt32BE)(input, 18)
|
|
4959
|
-
})
|
|
4960
|
-
};
|
|
4961
|
-
}));
|
|
4962
|
-
//#endregion
|
|
4963
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/svg.js
|
|
4964
|
-
var require_svg = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
4965
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4966
|
-
exports.SVG = void 0;
|
|
4967
|
-
const utils_1 = require_utils();
|
|
4968
|
-
const svgReg = /<svg\s([^>"']|"[^"]*"|'[^']*')*>/;
|
|
4969
|
-
const extractorRegExps = {
|
|
4970
|
-
height: /\sheight=(['"])([^%]+?)\1/,
|
|
4971
|
-
root: svgReg,
|
|
4972
|
-
viewbox: /\sviewBox=(['"])(.+?)\1/i,
|
|
4973
|
-
width: /\swidth=(['"])([^%]+?)\1/
|
|
4974
|
-
};
|
|
4975
|
-
const INCH_CM = 2.54;
|
|
4976
|
-
const units = {
|
|
4977
|
-
in: 96,
|
|
4978
|
-
cm: 96 / INCH_CM,
|
|
4979
|
-
em: 16,
|
|
4980
|
-
ex: 8,
|
|
4981
|
-
m: 96 / INCH_CM * 100,
|
|
4982
|
-
mm: 96 / INCH_CM / 10,
|
|
4983
|
-
pc: 96 / 72 / 12,
|
|
4984
|
-
pt: 96 / 72,
|
|
4985
|
-
px: 1
|
|
4986
|
-
};
|
|
4987
|
-
const unitsReg = new RegExp(`^([0-9.]+(?:e\\d+)?)(${Object.keys(units).join("|")})?$`);
|
|
4988
|
-
function parseLength(len) {
|
|
4989
|
-
const m = unitsReg.exec(len);
|
|
4990
|
-
if (!m) return;
|
|
4991
|
-
return Math.round(Number(m[1]) * (units[m[2]] || 1));
|
|
4992
|
-
}
|
|
4993
|
-
function parseViewbox(viewbox) {
|
|
4994
|
-
const bounds = viewbox.split(" ");
|
|
4995
|
-
return {
|
|
4996
|
-
height: parseLength(bounds[3]),
|
|
4997
|
-
width: parseLength(bounds[2])
|
|
4998
|
-
};
|
|
4999
|
-
}
|
|
5000
|
-
function parseAttributes(root) {
|
|
5001
|
-
const width = root.match(extractorRegExps.width);
|
|
5002
|
-
const height = root.match(extractorRegExps.height);
|
|
5003
|
-
const viewbox = root.match(extractorRegExps.viewbox);
|
|
5004
|
-
return {
|
|
5005
|
-
height: height && parseLength(height[2]),
|
|
5006
|
-
viewbox: viewbox && parseViewbox(viewbox[2]),
|
|
5007
|
-
width: width && parseLength(width[2])
|
|
5008
|
-
};
|
|
5009
|
-
}
|
|
5010
|
-
function calculateByDimensions(attrs) {
|
|
5011
|
-
return {
|
|
5012
|
-
height: attrs.height,
|
|
5013
|
-
width: attrs.width
|
|
5014
|
-
};
|
|
5015
|
-
}
|
|
5016
|
-
function calculateByViewbox(attrs, viewbox) {
|
|
5017
|
-
const ratio = viewbox.width / viewbox.height;
|
|
5018
|
-
if (attrs.width) return {
|
|
5019
|
-
height: Math.floor(attrs.width / ratio),
|
|
5020
|
-
width: attrs.width
|
|
5021
|
-
};
|
|
5022
|
-
if (attrs.height) return {
|
|
5023
|
-
height: attrs.height,
|
|
5024
|
-
width: Math.floor(attrs.height * ratio)
|
|
5025
|
-
};
|
|
5026
|
-
return {
|
|
5027
|
-
height: viewbox.height,
|
|
5028
|
-
width: viewbox.width
|
|
5029
|
-
};
|
|
5030
|
-
}
|
|
5031
|
-
exports.SVG = {
|
|
5032
|
-
validate: (input) => svgReg.test((0, utils_1.toUTF8String)(input, 0, 1e3)),
|
|
5033
|
-
calculate(input) {
|
|
5034
|
-
const root = (0, utils_1.toUTF8String)(input).match(extractorRegExps.root);
|
|
5035
|
-
if (root) {
|
|
5036
|
-
const attrs = parseAttributes(root[0]);
|
|
5037
|
-
if (attrs.width && attrs.height) return calculateByDimensions(attrs);
|
|
5038
|
-
if (attrs.viewbox) return calculateByViewbox(attrs, attrs.viewbox);
|
|
5039
|
-
}
|
|
5040
|
-
throw new TypeError("Invalid SVG");
|
|
5041
|
-
}
|
|
5042
|
-
};
|
|
5043
|
-
}));
|
|
5044
|
-
//#endregion
|
|
5045
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/tga.js
|
|
5046
|
-
var require_tga = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
5047
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5048
|
-
exports.TGA = void 0;
|
|
5049
|
-
const utils_1 = require_utils();
|
|
5050
|
-
exports.TGA = {
|
|
5051
|
-
validate(input) {
|
|
5052
|
-
return (0, utils_1.readUInt16LE)(input, 0) === 0 && (0, utils_1.readUInt16LE)(input, 4) === 0;
|
|
5053
|
-
},
|
|
5054
|
-
calculate(input) {
|
|
5055
|
-
return {
|
|
5056
|
-
height: (0, utils_1.readUInt16LE)(input, 14),
|
|
5057
|
-
width: (0, utils_1.readUInt16LE)(input, 12)
|
|
5058
|
-
};
|
|
5059
|
-
}
|
|
5060
|
-
};
|
|
5061
|
-
}));
|
|
5062
|
-
//#endregion
|
|
5063
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/tiff.js
|
|
5064
|
-
var require_tiff = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
5065
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5066
|
-
exports.TIFF = void 0;
|
|
5067
|
-
const fs$1 = __require("fs");
|
|
5068
|
-
const utils_1 = require_utils();
|
|
5069
|
-
function readIFD(input, filepath, isBigEndian) {
|
|
5070
|
-
const ifdOffset = (0, utils_1.readUInt)(input, 32, 4, isBigEndian);
|
|
5071
|
-
let bufferSize = 1024;
|
|
5072
|
-
const fileSize = fs$1.statSync(filepath).size;
|
|
5073
|
-
if (ifdOffset + bufferSize > fileSize) bufferSize = fileSize - ifdOffset - 10;
|
|
5074
|
-
const endBuffer = new Uint8Array(bufferSize);
|
|
5075
|
-
const descriptor = fs$1.openSync(filepath, "r");
|
|
5076
|
-
fs$1.readSync(descriptor, endBuffer, 0, bufferSize, ifdOffset);
|
|
5077
|
-
fs$1.closeSync(descriptor);
|
|
5078
|
-
return endBuffer.slice(2);
|
|
5079
|
-
}
|
|
5080
|
-
function readValue(input, isBigEndian) {
|
|
5081
|
-
const low = (0, utils_1.readUInt)(input, 16, 8, isBigEndian);
|
|
5082
|
-
return ((0, utils_1.readUInt)(input, 16, 10, isBigEndian) << 16) + low;
|
|
5083
|
-
}
|
|
5084
|
-
function nextTag(input) {
|
|
5085
|
-
if (input.length > 24) return input.slice(12);
|
|
5086
|
-
}
|
|
5087
|
-
function extractTags(input, isBigEndian) {
|
|
5088
|
-
const tags = {};
|
|
5089
|
-
let temp = input;
|
|
5090
|
-
while (temp && temp.length) {
|
|
5091
|
-
const code = (0, utils_1.readUInt)(temp, 16, 0, isBigEndian);
|
|
5092
|
-
const type = (0, utils_1.readUInt)(temp, 16, 2, isBigEndian);
|
|
5093
|
-
const length = (0, utils_1.readUInt)(temp, 32, 4, isBigEndian);
|
|
5094
|
-
if (code === 0) break;
|
|
5095
|
-
else {
|
|
5096
|
-
if (length === 1 && (type === 3 || type === 4)) tags[code] = readValue(temp, isBigEndian);
|
|
5097
|
-
temp = nextTag(temp);
|
|
5098
|
-
}
|
|
5099
|
-
}
|
|
5100
|
-
return tags;
|
|
5101
|
-
}
|
|
5102
|
-
function determineEndianness(input) {
|
|
5103
|
-
const signature = (0, utils_1.toUTF8String)(input, 0, 2);
|
|
5104
|
-
if ("II" === signature) return "LE";
|
|
5105
|
-
else if ("MM" === signature) return "BE";
|
|
5106
|
-
}
|
|
5107
|
-
const signatures = ["49492a00", "4d4d002a"];
|
|
5108
|
-
exports.TIFF = {
|
|
5109
|
-
validate: (input) => signatures.includes((0, utils_1.toHexString)(input, 0, 4)),
|
|
5110
|
-
calculate(input, filepath) {
|
|
5111
|
-
if (!filepath) throw new TypeError("Tiff doesn't support buffer");
|
|
5112
|
-
const isBigEndian = determineEndianness(input) === "BE";
|
|
5113
|
-
const tags = extractTags(readIFD(input, filepath, isBigEndian), isBigEndian);
|
|
5114
|
-
const width = tags[256];
|
|
5115
|
-
const height = tags[257];
|
|
5116
|
-
if (!width || !height) throw new TypeError("Invalid Tiff. Missing tags");
|
|
5117
|
-
return {
|
|
5118
|
-
height,
|
|
5119
|
-
width
|
|
5120
|
-
};
|
|
5121
|
-
}
|
|
5122
|
-
};
|
|
5123
|
-
}));
|
|
5124
|
-
//#endregion
|
|
5125
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/webp.js
|
|
5126
|
-
var require_webp = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
5127
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5128
|
-
exports.WEBP = void 0;
|
|
5129
|
-
const utils_1 = require_utils();
|
|
5130
|
-
function calculateExtended(input) {
|
|
5131
|
-
return {
|
|
5132
|
-
height: 1 + (0, utils_1.readUInt24LE)(input, 7),
|
|
5133
|
-
width: 1 + (0, utils_1.readUInt24LE)(input, 4)
|
|
5134
|
-
};
|
|
5135
|
-
}
|
|
5136
|
-
function calculateLossless(input) {
|
|
5137
|
-
return {
|
|
5138
|
-
height: 1 + ((input[4] & 15) << 10 | input[3] << 2 | (input[2] & 192) >> 6),
|
|
5139
|
-
width: 1 + ((input[2] & 63) << 8 | input[1])
|
|
5140
|
-
};
|
|
5141
|
-
}
|
|
5142
|
-
function calculateLossy(input) {
|
|
5143
|
-
return {
|
|
5144
|
-
height: (0, utils_1.readInt16LE)(input, 8) & 16383,
|
|
5145
|
-
width: (0, utils_1.readInt16LE)(input, 6) & 16383
|
|
5146
|
-
};
|
|
5147
|
-
}
|
|
5148
|
-
exports.WEBP = {
|
|
5149
|
-
validate(input) {
|
|
5150
|
-
const riffHeader = "RIFF" === (0, utils_1.toUTF8String)(input, 0, 4);
|
|
5151
|
-
const webpHeader = "WEBP" === (0, utils_1.toUTF8String)(input, 8, 12);
|
|
5152
|
-
const vp8Header = "VP8" === (0, utils_1.toUTF8String)(input, 12, 15);
|
|
5153
|
-
return riffHeader && webpHeader && vp8Header;
|
|
5154
|
-
},
|
|
5155
|
-
calculate(input) {
|
|
5156
|
-
const chunkHeader = (0, utils_1.toUTF8String)(input, 12, 16);
|
|
5157
|
-
input = input.slice(20, 30);
|
|
5158
|
-
if (chunkHeader === "VP8X") {
|
|
5159
|
-
const extendedHeader = input[0];
|
|
5160
|
-
const validStart = (extendedHeader & 192) === 0;
|
|
5161
|
-
const validEnd = (extendedHeader & 1) === 0;
|
|
5162
|
-
if (validStart && validEnd) return calculateExtended(input);
|
|
5163
|
-
else throw new TypeError("Invalid WebP");
|
|
5164
|
-
}
|
|
5165
|
-
if (chunkHeader === "VP8 " && input[0] !== 47) return calculateLossy(input);
|
|
5166
|
-
const signature = (0, utils_1.toHexString)(input, 3, 6);
|
|
5167
|
-
if (chunkHeader === "VP8L" && signature !== "9d012a") return calculateLossless(input);
|
|
5168
|
-
throw new TypeError("Invalid WebP");
|
|
5169
|
-
}
|
|
5170
|
-
};
|
|
5171
|
-
}));
|
|
5172
|
-
//#endregion
|
|
5173
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/index.js
|
|
5174
|
-
var require_types = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
5175
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5176
|
-
exports.typeHandlers = void 0;
|
|
5177
|
-
const bmp_1 = require_bmp();
|
|
5178
|
-
const cur_1 = require_cur();
|
|
5179
|
-
const dds_1 = require_dds();
|
|
5180
|
-
const gif_1 = require_gif();
|
|
5181
|
-
const heif_1 = require_heif();
|
|
5182
|
-
const icns_1 = require_icns();
|
|
5183
|
-
const ico_1 = require_ico();
|
|
5184
|
-
const j2c_1 = require_j2c();
|
|
5185
|
-
const jp2_1 = require_jp2();
|
|
5186
|
-
const jpg_1 = require_jpg();
|
|
5187
|
-
const jxl_1 = require_jxl();
|
|
5188
|
-
const jxl_stream_1 = require_jxl_stream();
|
|
5189
|
-
const ktx_1 = require_ktx();
|
|
5190
|
-
const png_1 = require_png();
|
|
5191
|
-
const pnm_1 = require_pnm();
|
|
5192
|
-
const psd_1 = require_psd();
|
|
5193
|
-
const svg_1 = require_svg();
|
|
5194
|
-
const tga_1 = require_tga();
|
|
5195
|
-
const tiff_1 = require_tiff();
|
|
5196
|
-
const webp_1 = require_webp();
|
|
5197
|
-
exports.typeHandlers = {
|
|
5198
|
-
bmp: bmp_1.BMP,
|
|
5199
|
-
cur: cur_1.CUR,
|
|
5200
|
-
dds: dds_1.DDS,
|
|
5201
|
-
gif: gif_1.GIF,
|
|
5202
|
-
heif: heif_1.HEIF,
|
|
5203
|
-
icns: icns_1.ICNS,
|
|
5204
|
-
ico: ico_1.ICO,
|
|
5205
|
-
j2c: j2c_1.J2C,
|
|
5206
|
-
jp2: jp2_1.JP2,
|
|
5207
|
-
jpg: jpg_1.JPG,
|
|
5208
|
-
jxl: jxl_1.JXL,
|
|
5209
|
-
"jxl-stream": jxl_stream_1.JXLStream,
|
|
5210
|
-
ktx: ktx_1.KTX,
|
|
5211
|
-
png: png_1.PNG,
|
|
5212
|
-
pnm: pnm_1.PNM,
|
|
5213
|
-
psd: psd_1.PSD,
|
|
5214
|
-
svg: svg_1.SVG,
|
|
5215
|
-
tga: tga_1.TGA,
|
|
5216
|
-
tiff: tiff_1.TIFF,
|
|
5217
|
-
webp: webp_1.WEBP
|
|
5218
|
-
};
|
|
5219
|
-
}));
|
|
5220
|
-
//#endregion
|
|
5221
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/detector.js
|
|
5222
|
-
var require_detector = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
5223
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5224
|
-
exports.detector = void 0;
|
|
5225
|
-
const index_1 = require_types();
|
|
5226
|
-
const keys = Object.keys(index_1.typeHandlers);
|
|
5227
|
-
const firstBytes = {
|
|
5228
|
-
56: "psd",
|
|
5229
|
-
66: "bmp",
|
|
5230
|
-
68: "dds",
|
|
5231
|
-
71: "gif",
|
|
5232
|
-
73: "tiff",
|
|
5233
|
-
77: "tiff",
|
|
5234
|
-
82: "webp",
|
|
5235
|
-
105: "icns",
|
|
5236
|
-
137: "png",
|
|
5237
|
-
255: "jpg"
|
|
5238
|
-
};
|
|
5239
|
-
function detector(input) {
|
|
5240
|
-
const byte = input[0];
|
|
5241
|
-
if (byte in firstBytes) {
|
|
5242
|
-
const type = firstBytes[byte];
|
|
5243
|
-
if (type && index_1.typeHandlers[type].validate(input)) return type;
|
|
5244
|
-
}
|
|
5245
|
-
const finder = (key) => index_1.typeHandlers[key].validate(input);
|
|
5246
|
-
return keys.find(finder);
|
|
5247
|
-
}
|
|
5248
|
-
exports.detector = detector;
|
|
5249
|
-
}));
|
|
5250
|
-
//#endregion
|
|
5251
4087
|
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/diff/base.js
|
|
5252
|
-
var
|
|
5253
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5254
|
-
exports.types = exports.setConcurrency = exports.disableTypes = exports.disableFS = exports.imageSize = void 0;
|
|
5255
|
-
const fs = __require("fs");
|
|
5256
|
-
const path = __require("path");
|
|
5257
|
-
const queue_1 = require_queue();
|
|
5258
|
-
const index_1 = require_types();
|
|
5259
|
-
const detector_1 = require_detector();
|
|
5260
|
-
const MaxInputSize = 512 * 1024;
|
|
5261
|
-
const queue = new queue_1.default({
|
|
5262
|
-
concurrency: 100,
|
|
5263
|
-
autostart: true
|
|
5264
|
-
});
|
|
5265
|
-
const globalOptions = {
|
|
5266
|
-
disabledFS: false,
|
|
5267
|
-
disabledTypes: []
|
|
5268
|
-
};
|
|
5269
|
-
/**
|
|
5270
|
-
* Return size information based on an Uint8Array
|
|
5271
|
-
*
|
|
5272
|
-
* @param {Uint8Array} input
|
|
5273
|
-
* @param {String} filepath
|
|
5274
|
-
* @returns {Object}
|
|
5275
|
-
*/
|
|
5276
|
-
function lookup(input, filepath) {
|
|
5277
|
-
const type = (0, detector_1.detector)(input);
|
|
5278
|
-
if (typeof type !== "undefined") {
|
|
5279
|
-
if (globalOptions.disabledTypes.indexOf(type) > -1) throw new TypeError("disabled file type: " + type);
|
|
5280
|
-
if (type in index_1.typeHandlers) {
|
|
5281
|
-
const size = index_1.typeHandlers[type].calculate(input, filepath);
|
|
5282
|
-
if (size !== void 0) {
|
|
5283
|
-
size.type = size.type ?? type;
|
|
5284
|
-
return size;
|
|
5285
|
-
}
|
|
5286
|
-
}
|
|
5287
|
-
}
|
|
5288
|
-
throw new TypeError("unsupported file type: " + type + " (file: " + filepath + ")");
|
|
5289
|
-
}
|
|
5290
|
-
/**
|
|
5291
|
-
* Reads a file into an Uint8Array.
|
|
5292
|
-
* @param {String} filepath
|
|
5293
|
-
* @returns {Promise<Uint8Array>}
|
|
5294
|
-
*/
|
|
5295
|
-
async function readFileAsync(filepath) {
|
|
5296
|
-
const handle = await fs.promises.open(filepath, "r");
|
|
5297
|
-
try {
|
|
5298
|
-
const { size } = await handle.stat();
|
|
5299
|
-
if (size <= 0) throw new Error("Empty file");
|
|
5300
|
-
const inputSize = Math.min(size, MaxInputSize);
|
|
5301
|
-
const input = new Uint8Array(inputSize);
|
|
5302
|
-
await handle.read(input, 0, inputSize, 0);
|
|
5303
|
-
return input;
|
|
5304
|
-
} finally {
|
|
5305
|
-
await handle.close();
|
|
5306
|
-
}
|
|
5307
|
-
}
|
|
5308
|
-
/**
|
|
5309
|
-
* Synchronously reads a file into an Uint8Array, blocking the nodejs process.
|
|
5310
|
-
*
|
|
5311
|
-
* @param {String} filepath
|
|
5312
|
-
* @returns {Uint8Array}
|
|
5313
|
-
*/
|
|
5314
|
-
function readFileSync(filepath) {
|
|
5315
|
-
const descriptor = fs.openSync(filepath, "r");
|
|
5316
|
-
try {
|
|
5317
|
-
const { size } = fs.fstatSync(descriptor);
|
|
5318
|
-
if (size <= 0) throw new Error("Empty file");
|
|
5319
|
-
const inputSize = Math.min(size, MaxInputSize);
|
|
5320
|
-
const input = new Uint8Array(inputSize);
|
|
5321
|
-
fs.readSync(descriptor, input, 0, inputSize, 0);
|
|
5322
|
-
return input;
|
|
5323
|
-
} finally {
|
|
5324
|
-
fs.closeSync(descriptor);
|
|
5325
|
-
}
|
|
5326
|
-
}
|
|
5327
|
-
module.exports = exports = imageSize;
|
|
5328
|
-
exports.default = imageSize;
|
|
5329
|
-
/**
|
|
5330
|
-
* @param {Uint8Array|string} input - Uint8Array or relative/absolute path of the image file
|
|
5331
|
-
* @param {Function=} [callback] - optional function for async detection
|
|
5332
|
-
*/
|
|
5333
|
-
function imageSize(input, callback) {
|
|
5334
|
-
if (input instanceof Uint8Array) return lookup(input);
|
|
5335
|
-
if (typeof input !== "string" || globalOptions.disabledFS) throw new TypeError("invalid invocation. input should be a Uint8Array");
|
|
5336
|
-
const filepath = path.resolve(input);
|
|
5337
|
-
if (typeof callback === "function") queue.push(() => readFileAsync(filepath).then((input) => process.nextTick(callback, null, lookup(input, filepath))).catch(callback));
|
|
5338
|
-
else return lookup(readFileSync(filepath), filepath);
|
|
5339
|
-
}
|
|
5340
|
-
exports.imageSize = imageSize;
|
|
5341
|
-
const disableFS = (v) => {
|
|
5342
|
-
globalOptions.disabledFS = v;
|
|
5343
|
-
};
|
|
5344
|
-
exports.disableFS = disableFS;
|
|
5345
|
-
const disableTypes = (types) => {
|
|
5346
|
-
globalOptions.disabledTypes = types;
|
|
5347
|
-
};
|
|
5348
|
-
exports.disableTypes = disableTypes;
|
|
5349
|
-
const setConcurrency = (c) => {
|
|
5350
|
-
queue.concurrency = c;
|
|
5351
|
-
};
|
|
5352
|
-
exports.setConcurrency = setConcurrency;
|
|
5353
|
-
exports.types = Object.keys(index_1.typeHandlers);
|
|
5354
|
-
})))(), 1);
|
|
4088
|
+
var import_sync = /* @__PURE__ */ __toESM$1(require_sync(), 1);
|
|
5355
4089
|
var Diff = class {
|
|
5356
4090
|
diff(oldStr, newStr, options = {}) {
|
|
5357
4091
|
let callback;
|
|
@@ -5959,7 +4693,7 @@ function splitLines(text) {
|
|
|
5959
4693
|
return result;
|
|
5960
4694
|
}
|
|
5961
4695
|
//#endregion
|
|
5962
|
-
//#region ../memory/dist/src-
|
|
4696
|
+
//#region ../memory/dist/src-B_n15_Xg.js
|
|
5963
4697
|
var __defProp$3 = Object.defineProperty;
|
|
5964
4698
|
var __exportAll = (all, no_symbols) => {
|
|
5965
4699
|
let target = {};
|
|
@@ -20722,6 +19456,7 @@ var Extractor = class Extractor {
|
|
|
20722
19456
|
includePreviousExtraction;
|
|
20723
19457
|
metadataKeyPath;
|
|
20724
19458
|
onExtracted;
|
|
19459
|
+
retryStructuredExtractionOnEmptyObject;
|
|
20725
19460
|
/** @internal */
|
|
20726
19461
|
internal;
|
|
20727
19462
|
instructionsConfig;
|
|
@@ -20744,6 +19479,7 @@ var Extractor = class Extractor {
|
|
|
20744
19479
|
this.includePreviousExtraction = config.includePreviousExtraction ?? true;
|
|
20745
19480
|
this.metadataKeyPath = config.metadataKeyPath ?? `extracted.${slug}`;
|
|
20746
19481
|
this.onExtracted = config.onExtracted;
|
|
19482
|
+
this.retryStructuredExtractionOnEmptyObject = config.retryStructuredExtractionOnEmptyObject ?? false;
|
|
20747
19483
|
this.internal = internal;
|
|
20748
19484
|
}
|
|
20749
19485
|
async resolve(context) {
|
|
@@ -20756,7 +19492,8 @@ var Extractor = class Extractor {
|
|
|
20756
19492
|
...schema ? { schema } : {},
|
|
20757
19493
|
includePreviousExtraction: this.includePreviousExtraction,
|
|
20758
19494
|
metadataKeyPath: this.metadataKeyPath,
|
|
20759
|
-
onExtracted: this.onExtracted
|
|
19495
|
+
onExtracted: this.onExtracted,
|
|
19496
|
+
retryStructuredExtractionOnEmptyObject: this.retryStructuredExtractionOnEmptyObject
|
|
20760
19497
|
}, this.internal);
|
|
20761
19498
|
}
|
|
20762
19499
|
};
|
|
@@ -21075,6 +19812,9 @@ if (OM_DEBUG_LOG) {
|
|
|
21075
19812
|
function isAbortError$1(error, abortSignal) {
|
|
21076
19813
|
return abortSignal?.aborted === true || error instanceof DOMException && error.name === "AbortError" || error instanceof Error && error.name === "AbortError";
|
|
21077
19814
|
}
|
|
19815
|
+
function shouldRetryEmptyStructuredObject(object, extractors) {
|
|
19816
|
+
return Object.keys(object).length === 0 && extractors.some((extractor) => extractor.retryStructuredExtractionOnEmptyObject);
|
|
19817
|
+
}
|
|
21078
19818
|
async function extractStructuredValues(opts) {
|
|
21079
19819
|
const structuredExtractors = (opts.extractors ?? []).filter((extractor) => extractor.mode === "structured");
|
|
21080
19820
|
if (structuredExtractors.length === 0) return {
|
|
@@ -21111,8 +19851,10 @@ ${extractorInstructions}${priorLines.length > 0 ? `\n\n## Prior Extracted Values
|
|
|
21111
19851
|
return output.object;
|
|
21112
19852
|
};
|
|
21113
19853
|
let object;
|
|
19854
|
+
let retryEmptyObject = false;
|
|
21114
19855
|
try {
|
|
21115
19856
|
object = await generateWithStructuredOutput();
|
|
19857
|
+
retryEmptyObject = shouldRetryEmptyStructuredObject(object, structuredExtractors);
|
|
21116
19858
|
} catch (error) {
|
|
21117
19859
|
if (isAbortError$1(error, opts.abortSignal)) throw error;
|
|
21118
19860
|
try {
|
|
@@ -21129,6 +19871,19 @@ ${extractorInstructions}${priorLines.length > 0 ? `\n\n## Prior Extracted Values
|
|
|
21129
19871
|
};
|
|
21130
19872
|
}
|
|
21131
19873
|
}
|
|
19874
|
+
if (retryEmptyObject) try {
|
|
19875
|
+
object = await generateWithStructuredOutput(coreFeatures.has("json-prompt-injection:inline") ? "inline" : true);
|
|
19876
|
+
} catch (fallbackError) {
|
|
19877
|
+
if (isAbortError$1(fallbackError, opts.abortSignal)) throw fallbackError;
|
|
19878
|
+
const message = fallbackError instanceof Error ? fallbackError.message : String(fallbackError);
|
|
19879
|
+
return {
|
|
19880
|
+
values,
|
|
19881
|
+
failures: structuredExtractors.map((extractor) => ({
|
|
19882
|
+
slug: extractor.slug,
|
|
19883
|
+
error: message
|
|
19884
|
+
}))
|
|
19885
|
+
};
|
|
19886
|
+
}
|
|
21132
19887
|
for (const extractor of structuredExtractors) {
|
|
21133
19888
|
const value = object[extractor.slug];
|
|
21134
19889
|
if (value === void 0 || value === null || value === "") continue;
|
|
@@ -21464,6 +20219,16 @@ function sanitizeToolResultValue(value, seen = /* @__PURE__ */ new WeakMap()) {
|
|
|
21464
20219
|
}
|
|
21465
20220
|
return sanitizedObject;
|
|
21466
20221
|
}
|
|
20222
|
+
/**
|
|
20223
|
+
* Serializes a tool result without truncating it.
|
|
20224
|
+
*
|
|
20225
|
+
* Token accounting must see the full result: the truncation applied by
|
|
20226
|
+
* {@link formatToolResultForObserver} exists to bound what the Observer LLM reads,
|
|
20227
|
+
* not to describe what the agent's provider context actually holds.
|
|
20228
|
+
*/
|
|
20229
|
+
function serializeToolResultForTokenCounting(value) {
|
|
20230
|
+
return stringifyToolResult(value);
|
|
20231
|
+
}
|
|
21467
20232
|
function stringifyToolResult(value) {
|
|
21468
20233
|
if (typeof value === "string") return value;
|
|
21469
20234
|
const sanitized = sanitizeToolResultValue(value);
|
|
@@ -23174,6 +21939,40 @@ var ObserverRunner = class {
|
|
|
23174
21939
|
};
|
|
23175
21940
|
}
|
|
23176
21941
|
};
|
|
21942
|
+
/**
|
|
21943
|
+
* Synchronous image dimension lookup for in-memory image buffers.
|
|
21944
|
+
*
|
|
21945
|
+
* Uses `probe-image-size`'s sync parsers rather than `image-size`, which has unfixed
|
|
21946
|
+
* denial-of-service advisories (GHSA-w3rx-r6r6-pgpr / CVE-2025-71330 and
|
|
21947
|
+
* GHSA-5p2g-fcmc-qvqq) affecting every published version, on an archived repository
|
|
21948
|
+
* with no fixed release coming. A malformed 32-byte ICNS buffer was enough to hang the
|
|
21949
|
+
* parse loop and exhaust the heap, and image bytes reaching agent memory are untrusted.
|
|
21950
|
+
*
|
|
21951
|
+
* `probe-image-size` covers the formats models actually accept (PNG, JPEG, WebP, GIF,
|
|
21952
|
+
* AVIF, BMP, ICO, PSD, SVG, TIFF). Anything else returns `undefined`, which callers
|
|
21953
|
+
* already handle as "dimensions unknown".
|
|
21954
|
+
*/
|
|
21955
|
+
const probeBuffer = import_sync.default;
|
|
21956
|
+
/**
|
|
21957
|
+
* Read the pixel dimensions of an image buffer.
|
|
21958
|
+
*
|
|
21959
|
+
* @returns The dimensions, or `undefined` if the buffer isn't a recognized image.
|
|
21960
|
+
*/
|
|
21961
|
+
function measureImageBuffer(buffer) {
|
|
21962
|
+
let probed;
|
|
21963
|
+
try {
|
|
21964
|
+
probed = probeBuffer(buffer);
|
|
21965
|
+
} catch {
|
|
21966
|
+
return;
|
|
21967
|
+
}
|
|
21968
|
+
if (!probed) return;
|
|
21969
|
+
const { width, height } = probed;
|
|
21970
|
+
if (typeof width !== "number" || !Number.isFinite(width) || typeof height !== "number" || !Number.isFinite(height)) return;
|
|
21971
|
+
return {
|
|
21972
|
+
width,
|
|
21973
|
+
height
|
|
21974
|
+
};
|
|
21975
|
+
}
|
|
23177
21976
|
const IMAGE_FILE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
23178
21977
|
"png",
|
|
23179
21978
|
"jpg",
|
|
@@ -23446,7 +22245,7 @@ async function resolveImageDimensionsAsync(part) {
|
|
|
23446
22245
|
const url = resolveHttpAssetUrl(getObjectValue(part, "image") ?? getObjectValue(part, "data"));
|
|
23447
22246
|
if (!url) return existing;
|
|
23448
22247
|
try {
|
|
23449
|
-
const probeImageSize = (await import("./probe-image-size-
|
|
22248
|
+
const probeImageSize = (await import("./probe-image-size-mXCWYNrz.js").then((m) => /* @__PURE__ */ __toESM$1(m.default, 1))).default;
|
|
23450
22249
|
const probed = await probeImageSize(url, {
|
|
23451
22250
|
open_timeout: REMOTE_IMAGE_PROBE_TIMEOUT_MS,
|
|
23452
22251
|
response_timeout: REMOTE_IMAGE_PROBE_TIMEOUT_MS,
|
|
@@ -23479,26 +22278,23 @@ function resolveImageDimensions(part) {
|
|
|
23479
22278
|
width,
|
|
23480
22279
|
height
|
|
23481
22280
|
};
|
|
23482
|
-
|
|
23483
|
-
|
|
23484
|
-
|
|
23485
|
-
|
|
23486
|
-
|
|
23487
|
-
|
|
23488
|
-
|
|
23489
|
-
|
|
23490
|
-
|
|
23491
|
-
|
|
23492
|
-
|
|
23493
|
-
|
|
23494
|
-
|
|
23495
|
-
|
|
23496
|
-
}
|
|
23497
|
-
|
|
23498
|
-
|
|
23499
|
-
height
|
|
23500
|
-
};
|
|
23501
|
-
}
|
|
22281
|
+
const measured = measureImageBuffer(buffer);
|
|
22282
|
+
if (!measured) return {
|
|
22283
|
+
width,
|
|
22284
|
+
height
|
|
22285
|
+
};
|
|
22286
|
+
const measuredWidth = getFiniteNumber(measured.width);
|
|
22287
|
+
const measuredHeight = getFiniteNumber(measured.height);
|
|
22288
|
+
if (!measuredWidth || !measuredHeight) return {
|
|
22289
|
+
width,
|
|
22290
|
+
height
|
|
22291
|
+
};
|
|
22292
|
+
const resolved = {
|
|
22293
|
+
width: width ?? measuredWidth,
|
|
22294
|
+
height: height ?? measuredHeight
|
|
22295
|
+
};
|
|
22296
|
+
persistImageDimensions(part, resolved);
|
|
22297
|
+
return resolved;
|
|
23502
22298
|
}
|
|
23503
22299
|
function getBase64Size(base64) {
|
|
23504
22300
|
const sanitized = base64.replace(/\s+/g, "");
|
|
@@ -24057,7 +22853,7 @@ var TokenCounter = class TokenCounter {
|
|
|
24057
22853
|
let tokens = 0;
|
|
24058
22854
|
const cacheParts = [];
|
|
24059
22855
|
const countJsonContentPart = (contentPart) => {
|
|
24060
|
-
const formatted =
|
|
22856
|
+
const formatted = serializeToolResultForTokenCounting(contentPart);
|
|
24061
22857
|
tokens += this.countString(formatted);
|
|
24062
22858
|
cacheParts.push({
|
|
24063
22859
|
type: "json",
|
|
@@ -24359,39 +23155,68 @@ var TokenCounter = class TokenCounter {
|
|
|
24359
23155
|
if (isImageAttachment) await resolveImageDimensionsAsync(part);
|
|
24360
23156
|
return this.countAttachmentPartSync(part);
|
|
24361
23157
|
}
|
|
23158
|
+
/**
|
|
23159
|
+
* Count the name and the arguments of a tool call. Every state before the tool produces an
|
|
23160
|
+
* output holds the same call signature in the context window, so all of those states share
|
|
23161
|
+
* these cache kinds. `buildEstimateKey` hashes the text, so a shared kind stays correct and
|
|
23162
|
+
* keeps the estimate warm while the invocation moves from one state to the next.
|
|
23163
|
+
*/
|
|
23164
|
+
countToolCallSignature(part, invocation) {
|
|
23165
|
+
let tokens = 0;
|
|
23166
|
+
let overheadDelta = 0;
|
|
23167
|
+
if (invocation.toolName) tokens += this.readOrPersistPartEstimate(part, "tool-call-name", invocation.toolName);
|
|
23168
|
+
if (invocation.args) if (typeof invocation.args === "string") tokens += this.readOrPersistPartEstimate(part, "tool-call-args", invocation.args);
|
|
23169
|
+
else {
|
|
23170
|
+
const argsJson = JSON.stringify(invocation.args);
|
|
23171
|
+
tokens += this.readOrPersistPartEstimate(part, "tool-call-args-json", argsJson);
|
|
23172
|
+
overheadDelta -= 12;
|
|
23173
|
+
}
|
|
23174
|
+
return {
|
|
23175
|
+
tokens,
|
|
23176
|
+
overheadDelta
|
|
23177
|
+
};
|
|
23178
|
+
}
|
|
24362
23179
|
countNonAttachmentPart(part) {
|
|
24363
23180
|
let overheadDelta = 0;
|
|
24364
|
-
let
|
|
23181
|
+
let extraMessageDelta = 0;
|
|
24365
23182
|
if (part.type === "text") return {
|
|
24366
23183
|
tokens: this.readOrPersistPartEstimate(part, "text", part.text),
|
|
24367
23184
|
overheadDelta,
|
|
24368
|
-
|
|
23185
|
+
extraMessageDelta
|
|
24369
23186
|
};
|
|
24370
23187
|
if (part.type === "tool-invocation") {
|
|
24371
23188
|
const invocation = part.toolInvocation;
|
|
23189
|
+
const state = invocation.state;
|
|
24372
23190
|
let tokens = 0;
|
|
24373
|
-
if (
|
|
24374
|
-
|
|
24375
|
-
|
|
24376
|
-
|
|
24377
|
-
|
|
24378
|
-
|
|
24379
|
-
|
|
24380
|
-
|
|
23191
|
+
if (state === "call" || state === "partial-call" || state === "approval-requested") {
|
|
23192
|
+
const signature = this.countToolCallSignature(part, invocation);
|
|
23193
|
+
return {
|
|
23194
|
+
tokens: signature.tokens,
|
|
23195
|
+
overheadDelta: overheadDelta + signature.overheadDelta,
|
|
23196
|
+
extraMessageDelta
|
|
23197
|
+
};
|
|
23198
|
+
}
|
|
23199
|
+
if (state === "approval-responded") {
|
|
23200
|
+
extraMessageDelta++;
|
|
23201
|
+
const signature = this.countToolCallSignature(part, invocation);
|
|
23202
|
+
tokens += signature.tokens;
|
|
23203
|
+
overheadDelta += signature.overheadDelta;
|
|
23204
|
+
const reason = invocation.approval?.reason;
|
|
23205
|
+
if (reason) tokens += this.readOrPersistPartEstimate(part, "tool-approval-reason", reason);
|
|
24381
23206
|
return {
|
|
24382
23207
|
tokens,
|
|
24383
23208
|
overheadDelta,
|
|
24384
|
-
|
|
23209
|
+
extraMessageDelta
|
|
24385
23210
|
};
|
|
24386
23211
|
}
|
|
24387
|
-
if (
|
|
24388
|
-
|
|
23212
|
+
if (state === "result") {
|
|
23213
|
+
extraMessageDelta++;
|
|
24389
23214
|
const { value: resultForCounting, usingStoredModelOutput } = this.resolveToolResultForTokenCounting(part, invocation.result);
|
|
24390
23215
|
if (resultForCounting !== void 0) {
|
|
24391
23216
|
const contentTokens = this.countMultimodalToolResultContent(part, resultForCounting);
|
|
24392
23217
|
if (contentTokens !== void 0) tokens += contentTokens;
|
|
24393
23218
|
else {
|
|
24394
|
-
const formattedResult =
|
|
23219
|
+
const formattedResult = serializeToolResultForTokenCounting(resultForCounting);
|
|
24395
23220
|
tokens += this.readOrPersistPartEstimate(part, usingStoredModelOutput ? "tool-result-model-output-json" : "tool-result-json", formattedResult);
|
|
24396
23221
|
}
|
|
24397
23222
|
if (typeof resultForCounting !== "string") overheadDelta -= 12;
|
|
@@ -24399,36 +23224,45 @@ var TokenCounter = class TokenCounter {
|
|
|
24399
23224
|
return {
|
|
24400
23225
|
tokens,
|
|
24401
23226
|
overheadDelta,
|
|
24402
|
-
|
|
23227
|
+
extraMessageDelta
|
|
24403
23228
|
};
|
|
24404
23229
|
}
|
|
24405
|
-
if (
|
|
24406
|
-
|
|
23230
|
+
if (state === "output-denied") {
|
|
23231
|
+
extraMessageDelta++;
|
|
24407
23232
|
const reason = invocation.approval?.reason ?? "Tool call was not approved by the user";
|
|
24408
23233
|
tokens += this.readOrPersistPartEstimate(part, "tool-result-denied", reason);
|
|
24409
23234
|
return {
|
|
24410
23235
|
tokens,
|
|
24411
23236
|
overheadDelta,
|
|
24412
|
-
|
|
23237
|
+
extraMessageDelta
|
|
23238
|
+
};
|
|
23239
|
+
}
|
|
23240
|
+
if (state === "output-error") {
|
|
23241
|
+
extraMessageDelta++;
|
|
23242
|
+
const errorMessage = typeof invocation.errorText === "string" ? invocation.errorText : "Tool execution failed";
|
|
23243
|
+
tokens += this.readOrPersistPartEstimate(part, "tool-result-error", errorMessage);
|
|
23244
|
+
return {
|
|
23245
|
+
tokens,
|
|
23246
|
+
overheadDelta,
|
|
23247
|
+
extraMessageDelta
|
|
24413
23248
|
};
|
|
24414
23249
|
}
|
|
24415
|
-
throw new Error(`Unhandled tool-invocation state '${part.toolInvocation?.state}' in token counting for part type '${part.type}'`);
|
|
24416
23250
|
}
|
|
24417
23251
|
if (typeof part.type === "string" && part.type.startsWith("data-")) return {
|
|
24418
23252
|
tokens: 0,
|
|
24419
23253
|
overheadDelta,
|
|
24420
|
-
|
|
23254
|
+
extraMessageDelta
|
|
24421
23255
|
};
|
|
24422
23256
|
if (part.type === "reasoning") return {
|
|
24423
23257
|
tokens: 0,
|
|
24424
23258
|
overheadDelta,
|
|
24425
|
-
|
|
23259
|
+
extraMessageDelta
|
|
24426
23260
|
};
|
|
24427
23261
|
const serialized = serializePartForTokenCounting(part);
|
|
24428
23262
|
return {
|
|
24429
23263
|
tokens: this.readOrPersistPartEstimate(part, `part-${part.type}`, serialized),
|
|
24430
23264
|
overheadDelta,
|
|
24431
|
-
|
|
23265
|
+
extraMessageDelta
|
|
24432
23266
|
};
|
|
24433
23267
|
}
|
|
24434
23268
|
/**
|
|
@@ -24437,7 +23271,7 @@ var TokenCounter = class TokenCounter {
|
|
|
24437
23271
|
countMessage(message) {
|
|
24438
23272
|
let payloadTokens = this.countString(message.role);
|
|
24439
23273
|
let overhead = TokenCounter.TOKENS_PER_MESSAGE;
|
|
24440
|
-
let
|
|
23274
|
+
let extraMessageCount = 0;
|
|
24441
23275
|
if (typeof message.content === "string") payloadTokens += this.readOrPersistMessageEstimate(message, "message-content", message.content);
|
|
24442
23276
|
else if (message.content && typeof message.content === "object") {
|
|
24443
23277
|
if (message.content.content && !Array.isArray(message.content.parts)) payloadTokens += this.readOrPersistMessageEstimate(message, "content-content", message.content.content);
|
|
@@ -24450,16 +23284,16 @@ var TokenCounter = class TokenCounter {
|
|
|
24450
23284
|
const result = this.countNonAttachmentPart(part);
|
|
24451
23285
|
payloadTokens += result.tokens;
|
|
24452
23286
|
overhead += result.overheadDelta;
|
|
24453
|
-
|
|
23287
|
+
extraMessageCount += result.extraMessageDelta;
|
|
24454
23288
|
}
|
|
24455
23289
|
}
|
|
24456
|
-
if (
|
|
23290
|
+
if (extraMessageCount > 0) overhead += extraMessageCount * TokenCounter.TOKENS_PER_MESSAGE;
|
|
24457
23291
|
return Math.round(payloadTokens + overhead);
|
|
24458
23292
|
}
|
|
24459
23293
|
async countMessageAsync(message) {
|
|
24460
23294
|
let payloadTokens = this.countString(message.role);
|
|
24461
23295
|
let overhead = TokenCounter.TOKENS_PER_MESSAGE;
|
|
24462
|
-
let
|
|
23296
|
+
let extraMessageCount = 0;
|
|
24463
23297
|
if (typeof message.content === "string") payloadTokens += this.readOrPersistMessageEstimate(message, "message-content", message.content);
|
|
24464
23298
|
else if (message.content && typeof message.content === "object") {
|
|
24465
23299
|
if (message.content.content && !Array.isArray(message.content.parts)) payloadTokens += this.readOrPersistMessageEstimate(message, "content-content", message.content.content);
|
|
@@ -24472,10 +23306,10 @@ var TokenCounter = class TokenCounter {
|
|
|
24472
23306
|
const result = this.countNonAttachmentPart(part);
|
|
24473
23307
|
payloadTokens += result.tokens;
|
|
24474
23308
|
overhead += result.overheadDelta;
|
|
24475
|
-
|
|
23309
|
+
extraMessageCount += result.extraMessageDelta;
|
|
24476
23310
|
}
|
|
24477
23311
|
}
|
|
24478
|
-
if (
|
|
23312
|
+
if (extraMessageCount > 0) overhead += extraMessageCount * TokenCounter.TOKENS_PER_MESSAGE;
|
|
24479
23313
|
return Math.round(payloadTokens + overhead);
|
|
24480
23314
|
}
|
|
24481
23315
|
/**
|
|
@@ -24633,6 +23467,7 @@ var WorkingMemoryExtractor = class extends Extractor {
|
|
|
24633
23467
|
name: "Working Memory",
|
|
24634
23468
|
includePreviousExtraction: false,
|
|
24635
23469
|
metadataKeyPath: false,
|
|
23470
|
+
retryStructuredExtractionOnEmptyObject: true,
|
|
24636
23471
|
instructions: async (context) => buildWorkingMemoryInstructions(await getWorkingMemoryDetails(context)),
|
|
24637
23472
|
schema: async (context) => {
|
|
24638
23473
|
return (await getWorkingMemoryDetails(context)).usesSchema ? z$2.union([z$2.record(z$2.string(), z$2.unknown()), z$2.null()]) : void 0;
|
|
@@ -24779,9 +23614,10 @@ async function listThreadsForResource({ memory, resourceId, currentThreadId, pag
|
|
|
24779
23614
|
hasMore
|
|
24780
23615
|
};
|
|
24781
23616
|
}
|
|
23617
|
+
const SEARCH_NOT_CONFIGURED_MESSAGE = "Search is not configured. Enable it with `retrieval: { vector: true }` and configure a vector store and embedder on your Memory instance.";
|
|
24782
23618
|
async function searchMessagesForResource({ memory, resourceId, currentThreadId, query, topK = 10, maxTokens = DEFAULT_MAX_RESULT_TOKENS, before, after, threadScope }) {
|
|
24783
23619
|
if (!memory.searchMessages) return {
|
|
24784
|
-
results:
|
|
23620
|
+
results: SEARCH_NOT_CONFIGURED_MESSAGE,
|
|
24785
23621
|
count: 0
|
|
24786
23622
|
};
|
|
24787
23623
|
const MAX_TOPK = 20;
|
|
@@ -25327,9 +24163,16 @@ async function recallThreadFromStart({ memory, threadId, resourceId, page = 1, l
|
|
|
25327
24163
|
}
|
|
25328
24164
|
const recallTool = (_memoryConfig, options) => {
|
|
25329
24165
|
const isResourceScope = (options?.retrievalScope ?? "thread") === "resource";
|
|
24166
|
+
const searchEnabled = options?.searchEnabled ?? true;
|
|
24167
|
+
const description = isResourceScope ? `Browse conversation history. Use mode="threads" to list all threads for the current user. Use mode="messages" (default) to browse messages in the current thread or pass threadId to browse another thread in the active resource. When mode="messages" has no cursor or threadId, it defaults to the current thread and says so at the top of the result. If you pass only a cursor, it must belong to the current thread.${searchEnabled ? " Use mode=\"search\" to find messages by content across all threads." : ""}` : `Browse conversation history in the current thread. Use mode="messages" (default) to page through messages near a cursor.${searchEnabled ? " Use mode=\"search\" to find messages by content in this thread." : ""} Use mode="threads" to get the current thread's ID and title.`;
|
|
24168
|
+
const modeEnum = searchEnabled ? [
|
|
24169
|
+
"messages",
|
|
24170
|
+
"threads",
|
|
24171
|
+
"search"
|
|
24172
|
+
] : ["messages", "threads"];
|
|
25330
24173
|
return createTool({
|
|
25331
24174
|
id: "recall",
|
|
25332
|
-
description
|
|
24175
|
+
description,
|
|
25333
24176
|
inputSchema: {
|
|
25334
24177
|
$schema: "http://json-schema.org/draft-07/schema#",
|
|
25335
24178
|
type: "object",
|
|
@@ -25337,12 +24180,8 @@ const recallTool = (_memoryConfig, options) => {
|
|
|
25337
24180
|
...isResourceScope ? {
|
|
25338
24181
|
mode: {
|
|
25339
24182
|
type: "string",
|
|
25340
|
-
enum:
|
|
25341
|
-
|
|
25342
|
-
"threads",
|
|
25343
|
-
"search"
|
|
25344
|
-
],
|
|
25345
|
-
description: "What to retrieve. \"messages\" (default) pages through message history. \"threads\" lists all threads for the current user. \"search\" finds messages by semantic similarity across all threads."
|
|
24183
|
+
enum: modeEnum,
|
|
24184
|
+
description: `What to retrieve. "messages" (default) pages through message history. "threads" lists all threads for the current user.${searchEnabled ? " \"search\" finds messages by semantic similarity across all threads." : ""}`
|
|
25346
24185
|
},
|
|
25347
24186
|
threadId: {
|
|
25348
24187
|
type: "string",
|
|
@@ -25359,18 +24198,14 @@ const recallTool = (_memoryConfig, options) => {
|
|
|
25359
24198
|
}
|
|
25360
24199
|
} : { mode: {
|
|
25361
24200
|
type: "string",
|
|
25362
|
-
enum:
|
|
25363
|
-
|
|
25364
|
-
"threads",
|
|
25365
|
-
"search"
|
|
25366
|
-
],
|
|
25367
|
-
description: "What to retrieve. \"messages\" (default) pages through message history. \"threads\" returns info about the current thread. \"search\" finds messages by semantic similarity in this thread."
|
|
24201
|
+
enum: modeEnum,
|
|
24202
|
+
description: `What to retrieve. "messages" (default) pages through message history. "threads" returns info about the current thread.${searchEnabled ? " \"search\" finds messages by semantic similarity in this thread." : ""}`
|
|
25368
24203
|
} },
|
|
25369
|
-
query: {
|
|
24204
|
+
...searchEnabled ? { query: {
|
|
25370
24205
|
type: "string",
|
|
25371
24206
|
minLength: 1,
|
|
25372
24207
|
description: "Search query for mode=\"search\". Finds messages semantically similar to this text."
|
|
25373
|
-
},
|
|
24208
|
+
} } : {},
|
|
25374
24209
|
cursor: {
|
|
25375
24210
|
type: "string",
|
|
25376
24211
|
minLength: 1,
|
|
@@ -25431,6 +24266,10 @@ const recallTool = (_memoryConfig, options) => {
|
|
|
25431
24266
|
if (!memory) throw new Error("Memory instance is required for recall");
|
|
25432
24267
|
if (explicitThreadId === "current" && !currentThreadId) throw new Error("Could not resolve current thread.");
|
|
25433
24268
|
if (mode === "search") {
|
|
24269
|
+
if (!searchEnabled) return {
|
|
24270
|
+
results: SEARCH_NOT_CONFIGURED_MESSAGE,
|
|
24271
|
+
count: 0
|
|
24272
|
+
};
|
|
25434
24273
|
if (!query) throw new Error("query is required for mode=\"search\"");
|
|
25435
24274
|
if (!resourceId) throw new Error("Resource ID is required for recall");
|
|
25436
24275
|
return searchMessagesForResource({
|
|
@@ -25565,6 +24404,7 @@ function deepMergeWorkingMemory(existing, update) {
|
|
|
25565
24404
|
for (const key of Object.keys(update)) {
|
|
25566
24405
|
const updateValue = update[key];
|
|
25567
24406
|
const existingValue = result[key];
|
|
24407
|
+
if (updateValue === void 0) continue;
|
|
25568
24408
|
if (updateValue === null) delete result[key];
|
|
25569
24409
|
else if (Array.isArray(updateValue)) result[key] = updateValue;
|
|
25570
24410
|
else if (typeof updateValue === "object" && updateValue !== null && typeof existingValue === "object" && existingValue !== null && !Array.isArray(existingValue)) result[key] = deepMergeWorkingMemory(existingValue, updateValue);
|
|
@@ -25617,7 +24457,7 @@ const updateWorkingMemoryTool = (memoryConfig) => {
|
|
|
25617
24457
|
version: 1,
|
|
25618
24458
|
vendor: "mastra",
|
|
25619
24459
|
validate: (value) => {
|
|
25620
|
-
const memoryValue = !!value && typeof value === "object" && !Array.isArray(value) && "memory" in value ? value.memory :
|
|
24460
|
+
const memoryValue = stripNullsFromOptional(!!value && typeof value === "object" && !Array.isArray(value) && "memory" in value ? value.memory : value, jsonSchema);
|
|
25621
24461
|
const result = validateMemory(memoryValue);
|
|
25622
24462
|
return result instanceof Promise ? result.then(toWrappedResult) : toWrappedResult(result);
|
|
25623
24463
|
},
|
|
@@ -25634,6 +24474,7 @@ const updateWorkingMemoryTool = (memoryConfig) => {
|
|
|
25634
24474
|
id: "update-working-memory",
|
|
25635
24475
|
description: schema ? useStateSignals ? `${stateSignalsPreamble} Data is merged with existing memory — only include fields you want to add or update.` : `Update the working memory with new information. Data is merged with existing memory - only include fields you want to add or update. To preserve existing data, omit the field entirely. Arrays are replaced entirely when provided, so pass the complete array or omit it to keep the existing values.` : useStateSignals ? `${stateSignalsPreamble} Pass the full updated Markdown blob as a string in the memory field.` : `Update the working memory with new information. Any data not included will be overwritten. Always pass data as string to the memory field. Never pass an object.`,
|
|
25636
24476
|
inputSchema,
|
|
24477
|
+
...usesMergeSemantics ? { strict: false } : {},
|
|
25637
24478
|
execute: async (inputData, context) => {
|
|
25638
24479
|
const workingMemoryInput = inputData;
|
|
25639
24480
|
const threadId = context?.agent?.threadId;
|
|
@@ -26374,6 +25215,24 @@ function getUnobservedPartsPreservingToolCallPairs(message) {
|
|
|
26374
25215
|
return preservedCalls.length > 0 ? [...preservedCalls, ...unobservedParts] : unobservedParts;
|
|
26375
25216
|
}
|
|
26376
25217
|
/**
|
|
25218
|
+
* Get the messages Observational Memory is allowed to work with.
|
|
25219
|
+
*
|
|
25220
|
+
* Messages supplied through the `context` option are per-run ephemeral input. Core's
|
|
25221
|
+
* persistence contract already treats them as never-persist: `MessageStateManager` routes
|
|
25222
|
+
* them into `userContextMessages`, and `drainUnsavedMessages` only drains input/response.
|
|
25223
|
+
*
|
|
25224
|
+
* OM builds its windows from `get.all.db()`, which includes context messages, and then
|
|
25225
|
+
* seals and persists candidates directly — turning ephemeral context into durable user
|
|
25226
|
+
* messages. Excluding them here keeps OM's window, sealing, persistence and token
|
|
25227
|
+
* accounting consistent with that contract.
|
|
25228
|
+
*/
|
|
25229
|
+
function getObservableMessages(messageList) {
|
|
25230
|
+
const allMessages = messageList.get.all.db();
|
|
25231
|
+
const contextMessageIds = messageList.makeMessageSourceChecker().context;
|
|
25232
|
+
if (contextMessageIds.size === 0) return allMessages;
|
|
25233
|
+
return allMessages.filter((message) => !contextMessageIds.has(message.id));
|
|
25234
|
+
}
|
|
25235
|
+
/**
|
|
26377
25236
|
* Safely extract buffered observation chunks from a record.
|
|
26378
25237
|
* Handles both array and JSON-string formats, returning empty array if malformed.
|
|
26379
25238
|
*/
|
|
@@ -26386,7 +25245,7 @@ function getUnobservedPartsPreservingToolCallPairs(message) {
|
|
|
26386
25245
|
*/
|
|
26387
25246
|
function filterObservedMessages(opts) {
|
|
26388
25247
|
const { messageList, record } = opts;
|
|
26389
|
-
const allMessages = messageList
|
|
25248
|
+
const allMessages = getObservableMessages(messageList);
|
|
26390
25249
|
const useMarkerBoundaryPruning = opts.useMarkerBoundaryPruning ?? true;
|
|
26391
25250
|
const preserveMessageIds = opts.preserveMessageIds ?? /* @__PURE__ */ new Set();
|
|
26392
25251
|
const observedIds = new Set(Array.isArray(record?.observedMessageIds) ? record.observedMessageIds : []);
|
|
@@ -26798,7 +25657,7 @@ var ObservationStrategy = class ObservationStrategy {
|
|
|
26798
25657
|
transient: true
|
|
26799
25658
|
}).catch(() => {});
|
|
26800
25659
|
const markerThreadId = marker.data?.threadId ?? this.opts.threadId;
|
|
26801
|
-
await this.persistMarkerToStorage(marker, markerThreadId, this.opts.resourceId);
|
|
25660
|
+
if (!await this.persistMarkerToMessage(marker, this.opts.messageList, markerThreadId, this.opts.resourceId)) await this.persistMarkerToStorage(marker, markerThreadId, this.opts.resourceId);
|
|
26802
25661
|
}
|
|
26803
25662
|
getObservationMarkerConfig() {
|
|
26804
25663
|
return {
|
|
@@ -26926,10 +25785,14 @@ var ObservationStrategy = class ObservationStrategy {
|
|
|
26926
25785
|
/**
|
|
26927
25786
|
* Persist a marker part on the last assistant message in a MessageList
|
|
26928
25787
|
* AND save the updated message to the DB.
|
|
25788
|
+
*
|
|
25789
|
+
* @returns true when a marker was placed on an assistant message, false when
|
|
25790
|
+
* no list was provided or the list contains no assistant message (caller
|
|
25791
|
+
* should fall back to `persistMarkerToStorage`).
|
|
26929
25792
|
*/
|
|
26930
25793
|
async persistMarkerToMessage(marker, messageList, threadId, resourceId) {
|
|
26931
|
-
if (!messageList) return;
|
|
26932
|
-
const allMsgs = messageList
|
|
25794
|
+
if (!messageList) return false;
|
|
25795
|
+
const allMsgs = getObservableMessages(messageList);
|
|
26933
25796
|
for (let i = allMsgs.length - 1; i >= 0; i--) {
|
|
26934
25797
|
const msg = allMsgs[i];
|
|
26935
25798
|
if (msg?.role === "assistant" && msg.content?.parts && Array.isArray(msg.content.parts)) {
|
|
@@ -26944,9 +25807,10 @@ var ObservationStrategy = class ObservationStrategy {
|
|
|
26944
25807
|
} catch (e) {
|
|
26945
25808
|
omDebug(`[OM:persistMarker] failed to save marker to DB: ${e}`);
|
|
26946
25809
|
}
|
|
26947
|
-
return;
|
|
25810
|
+
return true;
|
|
26948
25811
|
}
|
|
26949
25812
|
}
|
|
25813
|
+
return false;
|
|
26950
25814
|
}
|
|
26951
25815
|
};
|
|
26952
25816
|
var SyncObservationStrategy = class extends ObservationStrategy {
|
|
@@ -27109,7 +25973,7 @@ var SyncObservationStrategy = class extends ObservationStrategy {
|
|
|
27109
25973
|
});
|
|
27110
25974
|
await this.storage.updateThread({
|
|
27111
25975
|
id: threadId,
|
|
27112
|
-
|
|
25976
|
+
...shouldUpdateThreadTitle ? { title: newTitle } : {},
|
|
27113
25977
|
metadata: newMetadata
|
|
27114
25978
|
});
|
|
27115
25979
|
if (shouldUpdateThreadTitle) threadUpdateMarker = createThreadUpdateMarker({
|
|
@@ -27299,7 +26163,7 @@ var AsyncBufferObservationStrategy = class extends ObservationStrategy {
|
|
|
27299
26163
|
});
|
|
27300
26164
|
await this.storage.updateThread({
|
|
27301
26165
|
id: threadId,
|
|
27302
|
-
|
|
26166
|
+
...shouldUpdateThreadTitle ? { title: newTitle } : {},
|
|
27303
26167
|
metadata: newMetadata
|
|
27304
26168
|
});
|
|
27305
26169
|
if (shouldUpdateThreadTitle) {
|
|
@@ -27642,7 +26506,7 @@ var ResourceScopedObservationStrategy = class extends ObservationStrategy {
|
|
|
27642
26506
|
});
|
|
27643
26507
|
await this.storage.updateThread({
|
|
27644
26508
|
id: update.threadId,
|
|
27645
|
-
|
|
26509
|
+
...shouldUpdateThreadTitle ? { title: newTitle } : {},
|
|
27646
26510
|
metadata: newMetadata
|
|
27647
26511
|
});
|
|
27648
26512
|
if (shouldUpdateThreadTitle) threadUpdateMarkers.push(createThreadUpdateMarker({
|
|
@@ -27743,6 +26607,12 @@ var ObservationStep = class {
|
|
|
27743
26607
|
stepNumber;
|
|
27744
26608
|
_prepared = false;
|
|
27745
26609
|
_context;
|
|
26610
|
+
/**
|
|
26611
|
+
* True when this step seeded an empty assistant response message for a step-0
|
|
26612
|
+
* observation. While set, the response-id rotation hook must NOT run — rotating
|
|
26613
|
+
* would orphan the seed (markers would sit on a message the agent never streams into).
|
|
26614
|
+
*/
|
|
26615
|
+
seededResponseMessage = false;
|
|
27746
26616
|
constructor(turn, stepNumber) {
|
|
27747
26617
|
this.turn = turn;
|
|
27748
26618
|
this.stepNumber = stepNumber;
|
|
@@ -27789,7 +26659,7 @@ var ObservationStep = class {
|
|
|
27789
26659
|
let didThresholdCleanup = false;
|
|
27790
26660
|
let observerExchange;
|
|
27791
26661
|
if (this.stepNumber === 0) {
|
|
27792
|
-
const step0Messages = messageList
|
|
26662
|
+
const step0Messages = getObservableMessages(messageList);
|
|
27793
26663
|
const activation = await om.activate({
|
|
27794
26664
|
threadId,
|
|
27795
26665
|
resourceId,
|
|
@@ -27821,7 +26691,7 @@ var ObservationStep = class {
|
|
|
27821
26691
|
currentModel: this.turn.actorModelContext,
|
|
27822
26692
|
requestContext: this.turn.requestContext,
|
|
27823
26693
|
observabilityContext: this.turn.observabilityContext,
|
|
27824
|
-
lastActivityAt: getLastActivityFromMessages(messageList
|
|
26694
|
+
lastActivityAt: getLastActivityFromMessages(getObservableMessages(messageList)),
|
|
27825
26695
|
reflectionHooks: om.composeHooks(void 0, {
|
|
27826
26696
|
threadId,
|
|
27827
26697
|
resourceId,
|
|
@@ -27831,7 +26701,7 @@ var ObservationStep = class {
|
|
|
27831
26701
|
await this.turn.refreshRecord();
|
|
27832
26702
|
if (this.turn.record.generationCount > preReflectGeneration) reflected = true;
|
|
27833
26703
|
}
|
|
27834
|
-
const allMsgsForToolCheck = messageList
|
|
26704
|
+
const allMsgsForToolCheck = getObservableMessages(messageList);
|
|
27835
26705
|
const lastMessage = allMsgsForToolCheck[allMsgsForToolCheck.length - 1];
|
|
27836
26706
|
const pendingStepMessages = [...messageList.get.input.db(), ...messageList.get.response.db()];
|
|
27837
26707
|
const latestStepParts = [...getLatestStepParts(lastMessage?.content?.parts ?? []), ...pendingStepMessages.flatMap((msg) => getLatestStepParts(msg.content?.parts ?? []))];
|
|
@@ -27840,10 +26710,10 @@ var ObservationStep = class {
|
|
|
27840
26710
|
let statusSnapshot = await om.getStatus({
|
|
27841
26711
|
threadId,
|
|
27842
26712
|
resourceId,
|
|
27843
|
-
messages: messageList
|
|
26713
|
+
messages: getObservableMessages(messageList)
|
|
27844
26714
|
});
|
|
27845
26715
|
if (statusSnapshot.shouldBuffer && !hasIncompleteToolCalls) {
|
|
27846
|
-
const allMessages = messageList
|
|
26716
|
+
const allMessages = getObservableMessages(messageList);
|
|
27847
26717
|
const unobservedMessages = om.getUnobservedMessages(allMessages, statusSnapshot.record);
|
|
27848
26718
|
const candidates = om.getUnobservedMessages(unobservedMessages, statusSnapshot.record, { excludeBuffered: true });
|
|
27849
26719
|
if (candidates.length > 0) {
|
|
@@ -27871,15 +26741,41 @@ var ObservationStep = class {
|
|
|
27871
26741
|
});
|
|
27872
26742
|
buffered = true;
|
|
27873
26743
|
}
|
|
27874
|
-
|
|
27875
|
-
|
|
27876
|
-
|
|
27877
|
-
|
|
27878
|
-
if (
|
|
27879
|
-
|
|
27880
|
-
|
|
26744
|
+
const willObserveNow = statusSnapshot.shouldObserve && !hasIncompleteToolCalls;
|
|
26745
|
+
/** In-flight message ids the step-0 cleanup must never remove from live context. */
|
|
26746
|
+
let step0PreserveIds;
|
|
26747
|
+
if (this.stepNumber > 0 || willObserveNow) {
|
|
26748
|
+
if (this.stepNumber > 0) {
|
|
26749
|
+
const newInput = messageList.clear.input.db();
|
|
26750
|
+
const newOutput = messageList.clear.response.db();
|
|
26751
|
+
const messagesToSave = [...newInput, ...newOutput];
|
|
26752
|
+
if (messagesToSave.length > 0) {
|
|
26753
|
+
await om.persistMessages(messagesToSave, threadId, resourceId);
|
|
26754
|
+
for (const msg of messagesToSave) messageList.add(msg, "memory");
|
|
26755
|
+
}
|
|
26756
|
+
} else {
|
|
26757
|
+
const pending = [...messageList.get.input.db(), ...messageList.get.response.db()];
|
|
26758
|
+
if (pending.length > 0) await om.persistMessages(pending, threadId, resourceId);
|
|
26759
|
+
step0PreserveIds = pending.map((msg) => msg.id);
|
|
26760
|
+
}
|
|
26761
|
+
if (this.stepNumber === 0 && willObserveNow && this.turn.responseMessageId) {
|
|
26762
|
+
const seed = {
|
|
26763
|
+
id: this.turn.responseMessageId,
|
|
26764
|
+
role: "assistant",
|
|
26765
|
+
content: {
|
|
26766
|
+
format: 2,
|
|
26767
|
+
parts: []
|
|
26768
|
+
},
|
|
26769
|
+
type: "text",
|
|
26770
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
26771
|
+
threadId,
|
|
26772
|
+
resourceId
|
|
26773
|
+
};
|
|
26774
|
+
messageList.add(seed, "response");
|
|
26775
|
+
this.seededResponseMessage = true;
|
|
26776
|
+
omDebug(`[OM:step0] seeded response message ${seed.id} for step-0 observation markers`);
|
|
27881
26777
|
}
|
|
27882
|
-
if (
|
|
26778
|
+
if (willObserveNow) {
|
|
27883
26779
|
const preObsGeneration = this.turn.record.generationCount;
|
|
27884
26780
|
const obsResult = await this.runThresholdObservation();
|
|
27885
26781
|
observerExchange = obsResult.observerExchange;
|
|
@@ -27893,7 +26789,8 @@ var ObservationStep = class {
|
|
|
27893
26789
|
resourceId,
|
|
27894
26790
|
messages: messageList,
|
|
27895
26791
|
observedMessageIds: observedIds,
|
|
27896
|
-
retentionFloor: minRemaining
|
|
26792
|
+
retentionFloor: minRemaining,
|
|
26793
|
+
preserveMessageIds: step0PreserveIds
|
|
27897
26794
|
});
|
|
27898
26795
|
if (statusSnapshot.asyncObservationEnabled) await om.resetBufferingState({
|
|
27899
26796
|
threadId,
|
|
@@ -27908,7 +26805,7 @@ var ObservationStep = class {
|
|
|
27908
26805
|
statusSnapshot = await om.getStatus({
|
|
27909
26806
|
threadId,
|
|
27910
26807
|
resourceId,
|
|
27911
|
-
messages: messageList
|
|
26808
|
+
messages: getObservableMessages(messageList)
|
|
27912
26809
|
});
|
|
27913
26810
|
}
|
|
27914
26811
|
const otherThreadsContext = await this.turn.refreshOtherThreadsContext();
|
|
@@ -27957,10 +26854,11 @@ var ObservationStep = class {
|
|
|
27957
26854
|
const { threadId, resourceId, messageList } = this.turn;
|
|
27958
26855
|
const om = this.turn.om;
|
|
27959
26856
|
await om.waitForBuffering(threadId, resourceId);
|
|
26857
|
+
const observableMessages = this.seededResponseMessage ? getObservableMessages(messageList).filter((msg) => msg.id !== this.turn.responseMessageId) : getObservableMessages(messageList);
|
|
27960
26858
|
const freshStatus = await om.getStatus({
|
|
27961
26859
|
threadId,
|
|
27962
26860
|
resourceId,
|
|
27963
|
-
messages:
|
|
26861
|
+
messages: observableMessages
|
|
27964
26862
|
});
|
|
27965
26863
|
if (!freshStatus.shouldObserve) return {
|
|
27966
26864
|
succeeded: false,
|
|
@@ -27970,7 +26868,7 @@ var ObservationStep = class {
|
|
|
27970
26868
|
const activation = await om.activate({
|
|
27971
26869
|
threadId,
|
|
27972
26870
|
resourceId,
|
|
27973
|
-
messages:
|
|
26871
|
+
messages: observableMessages,
|
|
27974
26872
|
currentModel: this.turn.actorModelContext,
|
|
27975
26873
|
writer: this.turn.writer,
|
|
27976
26874
|
messageList
|
|
@@ -27986,7 +26884,7 @@ var ObservationStep = class {
|
|
|
27986
26884
|
currentModel: this.turn.actorModelContext,
|
|
27987
26885
|
requestContext: this.turn.requestContext,
|
|
27988
26886
|
observabilityContext: this.turn.observabilityContext,
|
|
27989
|
-
lastActivityAt: getLastActivityFromMessages(messageList
|
|
26887
|
+
lastActivityAt: getLastActivityFromMessages(getObservableMessages(messageList)),
|
|
27990
26888
|
reflectionHooks: om.composeHooks(void 0, {
|
|
27991
26889
|
threadId,
|
|
27992
26890
|
resourceId,
|
|
@@ -28003,7 +26901,8 @@ var ObservationStep = class {
|
|
|
28003
26901
|
const obsResult = await om.observe({
|
|
28004
26902
|
threadId,
|
|
28005
26903
|
resourceId,
|
|
28006
|
-
messages:
|
|
26904
|
+
messages: observableMessages,
|
|
26905
|
+
messageList,
|
|
28007
26906
|
trigger: "turn-sync",
|
|
28008
26907
|
requestContext: this.turn.requestContext,
|
|
28009
26908
|
writer: this.turn.writer,
|
|
@@ -28011,7 +26910,7 @@ var ObservationStep = class {
|
|
|
28011
26910
|
});
|
|
28012
26911
|
if (obsResult.observed) {
|
|
28013
26912
|
const observedMessageIds = new Set(obsResult.record.observedMessageIds ?? []);
|
|
28014
|
-
const liveMessages = messageList
|
|
26913
|
+
const liveMessages = getObservableMessages(messageList);
|
|
28015
26914
|
let latestObservedIndex = -1;
|
|
28016
26915
|
for (let i = liveMessages.length - 1; i >= 0; i--) {
|
|
28017
26916
|
const message = liveMessages[i];
|
|
@@ -28020,10 +26919,12 @@ var ObservationStep = class {
|
|
|
28020
26919
|
break;
|
|
28021
26920
|
}
|
|
28022
26921
|
}
|
|
28023
|
-
|
|
26922
|
+
let messageToSeal = latestObservedIndex >= 0 ? liveMessages[latestObservedIndex] : void 0;
|
|
26923
|
+
if (this.stepNumber === 0 && messageToSeal?.role !== "assistant") messageToSeal = void 0;
|
|
28024
26924
|
const messagesToSeal = messageToSeal ? [messageToSeal] : [];
|
|
28025
26925
|
om.sealMessagesForBuffering(messagesToSeal);
|
|
28026
|
-
|
|
26926
|
+
if (this.seededResponseMessage) omDebug("[OM:observe] skipping response-id rotation — step-0 seeded response message holds the active id");
|
|
26927
|
+
else try {
|
|
28027
26928
|
await this.turn.hooks?.onSyncObservationComplete?.();
|
|
28028
26929
|
} catch (error) {
|
|
28029
26930
|
omDebug(`[OM:observe] onSyncObservationComplete hook failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -28082,6 +26983,8 @@ var ObservationTurn = class {
|
|
|
28082
26983
|
sendSignal;
|
|
28083
26984
|
/** Current actor model for this step. Updated by the processor before prepare(). */
|
|
28084
26985
|
actorModelContext;
|
|
26986
|
+
/** The active assistant response message ID for this step. Updated by the processor before prepare(). */
|
|
26987
|
+
responseMessageId;
|
|
28085
26988
|
/** Processor-provided hooks for turn/step lifecycle integration. */
|
|
28086
26989
|
hooks;
|
|
28087
26990
|
constructor(opts) {
|
|
@@ -28180,7 +27083,7 @@ var ObservationTurn = class {
|
|
|
28180
27083
|
const asyncObservationEnabled = this.om.buffering.isAsyncObservationEnabled();
|
|
28181
27084
|
const bufferOnIdle = this.om.getObservationConfig().bufferOnIdle;
|
|
28182
27085
|
if (asyncObservationEnabled && bufferOnIdle) {
|
|
28183
|
-
const allMessages = this.messageList
|
|
27086
|
+
const allMessages = getObservableMessages(this.messageList);
|
|
28184
27087
|
const record = this._record;
|
|
28185
27088
|
const unobservedMessages = this.om.getUnobservedMessages(allMessages, record);
|
|
28186
27089
|
if (unobservedMessages.length > 0) this.om.buffer({
|
|
@@ -28534,7 +27437,6 @@ async function persistThreadExtractedValues(storage, extractors, threadId, value
|
|
|
28534
27437
|
});
|
|
28535
27438
|
await storage.updateThread({
|
|
28536
27439
|
id: threadId,
|
|
28537
|
-
title: thread.title ?? "",
|
|
28538
27440
|
metadata: newMetadata
|
|
28539
27441
|
});
|
|
28540
27442
|
}
|
|
@@ -28546,7 +27448,7 @@ function getCurrentModel$1(model) {
|
|
|
28546
27448
|
return formatModelContext$1(model?.provider, model?.modelId);
|
|
28547
27449
|
}
|
|
28548
27450
|
function getLastModelFromMessageList(messageList) {
|
|
28549
|
-
const messages = messageList
|
|
27451
|
+
const messages = messageList ? getObservableMessages(messageList) : void 0;
|
|
28550
27452
|
if (!messages) return void 0;
|
|
28551
27453
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
28552
27454
|
const message = messages[i];
|
|
@@ -30126,7 +29028,7 @@ var ObservationalMemory = class ObservationalMemory {
|
|
|
30126
29028
|
*/
|
|
30127
29029
|
async persistMarkerToMessage(marker, messageList, threadId, resourceId) {
|
|
30128
29030
|
if (!messageList) return;
|
|
30129
|
-
const allMsgs = messageList
|
|
29031
|
+
const allMsgs = getObservableMessages(messageList);
|
|
30130
29032
|
for (let i = allMsgs.length - 1; i >= 0; i--) {
|
|
30131
29033
|
const msg = allMsgs[i];
|
|
30132
29034
|
if (msg?.role === "assistant" && msg.content?.parts && Array.isArray(msg.content.parts)) {
|
|
@@ -30742,6 +29644,7 @@ ${formattedMessages}
|
|
|
30742
29644
|
*/
|
|
30743
29645
|
async getObservedMessageIdsForCleanup(opts) {
|
|
30744
29646
|
const { threadId, resourceId, messages, observedMessageIds, retentionFloor } = opts;
|
|
29647
|
+
const preserveSet = opts.preserveMessageIds?.length ? new Set(opts.preserveMessageIds) : null;
|
|
30745
29648
|
const record = await this.getOrCreateRecord(threadId, resourceId);
|
|
30746
29649
|
const effectiveObservedIds = observedMessageIds && observedMessageIds.length > 0 ? observedMessageIds : Array.isArray(record.observedMessageIds) ? record.observedMessageIds : [];
|
|
30747
29650
|
if (effectiveObservedIds.length === 0) return [];
|
|
@@ -30753,6 +29656,10 @@ ${formattedMessages}
|
|
|
30753
29656
|
const retentionCounter = typeof retentionFloor === "number" ? new TokenCounter() : null;
|
|
30754
29657
|
for (const msg of messages) {
|
|
30755
29658
|
if (!msg?.id || msg.id === "om-continuation" || !observedSet.has(msg.id)) continue;
|
|
29659
|
+
if (preserveSet?.has(msg.id)) {
|
|
29660
|
+
skipped += 1;
|
|
29661
|
+
continue;
|
|
29662
|
+
}
|
|
30756
29663
|
const unobservedParts = getUnobservedParts(msg);
|
|
30757
29664
|
const totalParts = msg.content?.parts?.length ?? 0;
|
|
30758
29665
|
if (unobservedParts.length > 0 && unobservedParts.length < totalParts) {
|
|
@@ -30797,9 +29704,9 @@ ${formattedMessages}
|
|
|
30797
29704
|
*/
|
|
30798
29705
|
/** @internal Used by ObservationStep. */
|
|
30799
29706
|
async cleanupMessages(opts) {
|
|
30800
|
-
const { threadId, resourceId, observedMessageIds, retentionFloor } = opts;
|
|
29707
|
+
const { threadId, resourceId, observedMessageIds, retentionFloor, preserveMessageIds } = opts;
|
|
30801
29708
|
const messageList = this.isMessageList(opts.messages) ? opts.messages : void 0;
|
|
30802
|
-
const allMsgs = messageList ? messageList
|
|
29709
|
+
const allMsgs = messageList ? getObservableMessages(messageList) : opts.messages;
|
|
30803
29710
|
let markerIdx = -1;
|
|
30804
29711
|
let markerMsg = null;
|
|
30805
29712
|
for (let i = allMsgs.length - 1; i >= 0; i--) {
|
|
@@ -30818,7 +29725,8 @@ ${formattedMessages}
|
|
|
30818
29725
|
resourceId,
|
|
30819
29726
|
messages: allMsgs,
|
|
30820
29727
|
observedMessageIds,
|
|
30821
|
-
retentionFloor
|
|
29728
|
+
retentionFloor,
|
|
29729
|
+
preserveMessageIds
|
|
30822
29730
|
});
|
|
30823
29731
|
if (messageList) {
|
|
30824
29732
|
if (idsToRemoveList.length > 0) messageList.removeByIds(idsToRemoveList);
|
|
@@ -30830,18 +29738,21 @@ ${formattedMessages}
|
|
|
30830
29738
|
if (markerMsg && markerIdx !== -1) {
|
|
30831
29739
|
const idsToRemove = [];
|
|
30832
29740
|
const messagesToSave = [];
|
|
29741
|
+
const preserveSet = preserveMessageIds?.length ? new Set(preserveMessageIds) : null;
|
|
30833
29742
|
for (let i = 0; i < markerIdx; i++) {
|
|
30834
29743
|
const msg = allMsgs[i];
|
|
30835
|
-
if (msg?.id && msg.id !== "om-continuation") {
|
|
29744
|
+
if (msg?.id && msg.id !== "om-continuation" && !preserveSet?.has(msg.id)) {
|
|
30836
29745
|
idsToRemove.push(msg.id);
|
|
30837
29746
|
messagesToSave.push(msg);
|
|
30838
29747
|
}
|
|
30839
29748
|
}
|
|
30840
29749
|
messagesToSave.push(markerMsg);
|
|
30841
|
-
|
|
30842
|
-
|
|
30843
|
-
if (
|
|
30844
|
-
|
|
29750
|
+
if (!Boolean(markerMsg.id && preserveSet?.has(markerMsg.id))) {
|
|
29751
|
+
const unobservedParts = getUnobservedParts(markerMsg);
|
|
29752
|
+
if (unobservedParts.length === 0) {
|
|
29753
|
+
if (markerMsg.id) idsToRemove.push(markerMsg.id);
|
|
29754
|
+
} else if (unobservedParts.length < (markerMsg.content?.parts?.length ?? 0)) markerMsg.content.parts = unobservedParts;
|
|
29755
|
+
}
|
|
30845
29756
|
if (messageList) {
|
|
30846
29757
|
if (idsToRemove.length > 0) messageList.removeByIds(idsToRemove);
|
|
30847
29758
|
if (messagesToSave.length > 0) await this.persistMessages(messagesToSave, threadId, resourceId);
|
|
@@ -31493,7 +30404,7 @@ ${formattedMessages}
|
|
|
31493
30404
|
const shouldUpdateThreadTitle = !!newTitle && newTitle.length >= 3 && newTitle !== oldTitle;
|
|
31494
30405
|
await this.storage.updateThread({
|
|
31495
30406
|
id: threadId,
|
|
31496
|
-
|
|
30407
|
+
...shouldUpdateThreadTitle ? { title: newTitle } : {},
|
|
31497
30408
|
metadata: newMetadata
|
|
31498
30409
|
});
|
|
31499
30410
|
}
|
|
@@ -31628,6 +30539,7 @@ ${formattedMessages}
|
|
|
31628
30539
|
threadId,
|
|
31629
30540
|
resourceId,
|
|
31630
30541
|
messages: unobservedMessages,
|
|
30542
|
+
messageList: opts.messageList,
|
|
31631
30543
|
reflectionHooks,
|
|
31632
30544
|
agent: opts.agent,
|
|
31633
30545
|
requestContext,
|
|
@@ -31710,7 +30622,6 @@ ${formattedMessages}
|
|
|
31710
30622
|
});
|
|
31711
30623
|
await this.storage.updateThread({
|
|
31712
30624
|
id: threadId,
|
|
31713
|
-
title: thread.title ?? "",
|
|
31714
30625
|
metadata: newMetadata
|
|
31715
30626
|
});
|
|
31716
30627
|
}
|
|
@@ -31908,7 +30819,7 @@ function isTemporalGapMarkerForMessage(message, targetMessageId) {
|
|
|
31908
30819
|
async function insertTemporalGapMarkers({ messageList, sendSignal }) {
|
|
31909
30820
|
const latestInputMessage = messageList.get.input.db().filter((message) => Boolean(message)).at(-1);
|
|
31910
30821
|
if (!latestInputMessage || isTemporalGapMarker(latestInputMessage)) return;
|
|
31911
|
-
const allMessages = messageList
|
|
30822
|
+
const allMessages = getObservableMessages(messageList).filter((message) => Boolean(message));
|
|
31912
30823
|
const latestInputIndex = allMessages.findIndex((message) => message.id === latestInputMessage.id);
|
|
31913
30824
|
if (latestInputIndex <= 0) return;
|
|
31914
30825
|
if (allMessages.some((message) => isTemporalGapMarkerForMessage(message, latestInputMessage.id))) return;
|
|
@@ -32013,7 +30924,7 @@ var ObservationalMemoryProcessor = class {
|
|
|
32013
30924
|
this.temporalMarkers = options?.temporalMarkers ?? false;
|
|
32014
30925
|
}
|
|
32015
30926
|
async processInputStep(args) {
|
|
32016
|
-
const { messageList, requestContext, stepNumber, state: _state, writer, model, abortSignal, abort, rotateResponseMessageId } = args;
|
|
30927
|
+
const { messageList, requestContext, stepNumber, state: _state, writer, model, abortSignal, abort, messageId, rotateResponseMessageId } = args;
|
|
32017
30928
|
const state = _state ?? {};
|
|
32018
30929
|
omDebug(`[OM:processInputStep:ENTER] step=${stepNumber}, hasMastraMemory=${!!requestContext?.get("MastraMemory")}, hasMemoryInfo=${!!messageList?.serialize()?.memoryInfo?.threadId}`);
|
|
32019
30930
|
const context = this.engine.getThreadContext(requestContext, messageList);
|
|
@@ -32099,6 +31010,7 @@ var ObservationalMemoryProcessor = class {
|
|
|
32099
31010
|
state.__omObservabilityContext = observabilityContext;
|
|
32100
31011
|
this.turn.observabilityContext = observabilityContext;
|
|
32101
31012
|
this.turn.actorModelContext = actorModelContext;
|
|
31013
|
+
this.turn.responseMessageId = messageId;
|
|
32102
31014
|
{
|
|
32103
31015
|
const step = this.turn.step(stepNumber);
|
|
32104
31016
|
let ctx;
|
|
@@ -32129,7 +31041,7 @@ var ObservationalMemoryProcessor = class {
|
|
|
32129
31041
|
threadId,
|
|
32130
31042
|
resourceId
|
|
32131
31043
|
});
|
|
32132
|
-
const allDbMsgs = messageList
|
|
31044
|
+
const allDbMsgs = getObservableMessages(messageList);
|
|
32133
31045
|
const tokenCounter = this.engine.getTokenCounter();
|
|
32134
31046
|
const contextTokens = await tokenCounter.countMessagesAsync(allDbMsgs);
|
|
32135
31047
|
const otherThreadsContext = this.turn.context.otherThreadsContext;
|
|
@@ -32476,6 +31388,18 @@ var Memory = class extends MastraMemory {
|
|
|
32476
31388
|
_omEngine;
|
|
32477
31389
|
_omEngineInstance;
|
|
32478
31390
|
_mastraInstance;
|
|
31391
|
+
/**
|
|
31392
|
+
* Every vector cleanup that deleteThread or deleteMessages started in the background.
|
|
31393
|
+
* Callers do not wait for the cleanup, so this handle is the only join point.
|
|
31394
|
+
*/
|
|
31395
|
+
pendingVectorCleanup = Promise.resolve();
|
|
31396
|
+
/**
|
|
31397
|
+
* Adds a background vector cleanup to the join handle.
|
|
31398
|
+
* The handle keeps the earlier cleanups, so it settles only after all of them end.
|
|
31399
|
+
*/
|
|
31400
|
+
trackVectorCleanup(cleanup) {
|
|
31401
|
+
this.pendingVectorCleanup = Promise.allSettled([this.pendingVectorCleanup, cleanup]).then(() => void 0);
|
|
31402
|
+
}
|
|
32479
31403
|
/** The shared ObservationalMemory engine. Lazily created on first access. */
|
|
32480
31404
|
get omEngine() {
|
|
32481
31405
|
if (!this._omEngine) this._omEngine = this._initOMEngine().then((engine) => {
|
|
@@ -32740,26 +31664,40 @@ var Memory = class extends MastraMemory {
|
|
|
32740
31664
|
const thread = await memoryStore.getThreadById({ threadId });
|
|
32741
31665
|
await memoryStore.deleteThread({ threadId });
|
|
32742
31666
|
if (thread?.resourceId && memoryStore.supportsObservationalMemory) await memoryStore.clearObservationalMemory(threadId, thread.resourceId);
|
|
32743
|
-
if (this.vector) this.deleteThreadVectors(threadId);
|
|
31667
|
+
if (this.vector) this.trackVectorCleanup(this.deleteThreadVectors(threadId));
|
|
32744
31668
|
}
|
|
32745
31669
|
/**
|
|
32746
|
-
*
|
|
32747
|
-
*
|
|
31670
|
+
* Prefix shared by every message index. The index for the default embedding
|
|
31671
|
+
* dimension is named with the bare prefix; other dimensions add a suffix.
|
|
32748
31672
|
*/
|
|
32749
|
-
|
|
31673
|
+
get messageIndexPrefix() {
|
|
31674
|
+
return this.getEmbeddingIndexName();
|
|
31675
|
+
}
|
|
31676
|
+
/**
|
|
31677
|
+
* Prefix shared by every observation index. Each observation index adds a dimension suffix.
|
|
31678
|
+
*/
|
|
31679
|
+
get observationIndexPrefix() {
|
|
31680
|
+
return `memory${this.vector?.indexSeparator ?? "_"}observations`;
|
|
31681
|
+
}
|
|
31682
|
+
/**
|
|
31683
|
+
* Lists the vector indexes whose name starts with one of the given prefixes.
|
|
31684
|
+
* Index names can carry a dimension suffix, so discovery matches on the prefix.
|
|
31685
|
+
*/
|
|
31686
|
+
async getMemoryVectorIndexes(prefixes) {
|
|
32750
31687
|
if (!this.vector) return [];
|
|
32751
|
-
|
|
32752
|
-
return (await this.vector.listIndexes()).filter((name) => name.startsWith(prefix));
|
|
31688
|
+
return (await this.vector.listIndexes()).filter((name) => prefixes.some((prefix) => name.startsWith(prefix)));
|
|
32753
31689
|
}
|
|
32754
31690
|
/**
|
|
32755
31691
|
* Deletes all vector embeddings associated with a thread.
|
|
32756
31692
|
* This is called internally by deleteThread to clean up orphaned vectors.
|
|
31693
|
+
* Both message and observation vectors are removed, so no text of the deleted
|
|
31694
|
+
* thread stays reachable through resource-scoped retrieval.
|
|
32757
31695
|
*
|
|
32758
31696
|
* @param threadId - The ID of the thread whose vectors should be deleted
|
|
32759
31697
|
*/
|
|
32760
31698
|
async deleteThreadVectors(threadId) {
|
|
32761
31699
|
try {
|
|
32762
|
-
const memoryIndexes = await this.getMemoryVectorIndexes();
|
|
31700
|
+
const memoryIndexes = await this.getMemoryVectorIndexes([this.messageIndexPrefix, this.observationIndexPrefix]);
|
|
32763
31701
|
await Promise.all(memoryIndexes.map(async (indexName) => {
|
|
32764
31702
|
try {
|
|
32765
31703
|
await this.vector.deleteVectors({
|
|
@@ -32767,14 +31705,14 @@ var Memory = class extends MastraMemory {
|
|
|
32767
31705
|
filter: { thread_id: threadId }
|
|
32768
31706
|
});
|
|
32769
31707
|
} catch {
|
|
32770
|
-
this.logger.
|
|
31708
|
+
this.logger.warn("Failed to delete vectors of the deleted thread from index", {
|
|
32771
31709
|
threadId,
|
|
32772
31710
|
indexName
|
|
32773
31711
|
});
|
|
32774
31712
|
}
|
|
32775
31713
|
}));
|
|
32776
31714
|
} catch {
|
|
32777
|
-
this.logger.
|
|
31715
|
+
this.logger.warn("Failed to clean up vectors of the deleted thread", { threadId });
|
|
32778
31716
|
}
|
|
32779
31717
|
}
|
|
32780
31718
|
async updateWorkingMemory({ threadId, resourceId, workingMemory, memoryConfig, observabilityContext }) {
|
|
@@ -32802,7 +31740,6 @@ var Memory = class extends MastraMemory {
|
|
|
32802
31740
|
if (!thread) throw new Error(`Thread ${threadId} not found`);
|
|
32803
31741
|
await memoryStore.updateThread({
|
|
32804
31742
|
id: threadId,
|
|
32805
|
-
title: thread.title || "",
|
|
32806
31743
|
metadata: {
|
|
32807
31744
|
...thread.metadata,
|
|
32808
31745
|
workingMemory
|
|
@@ -32891,7 +31828,6 @@ ${workingMemory}`;
|
|
|
32891
31828
|
if (!thread) throw new Error(`Thread ${threadId} not found`);
|
|
32892
31829
|
await memoryStore.updateThread({
|
|
32893
31830
|
id: threadId,
|
|
32894
|
-
title: thread.title || "",
|
|
32895
31831
|
metadata: {
|
|
32896
31832
|
...thread.metadata,
|
|
32897
31833
|
workingMemory
|
|
@@ -33447,7 +32383,7 @@ Notes:
|
|
|
33447
32383
|
getObservationEmbeddingIndexName(dimensions) {
|
|
33448
32384
|
const usedDimensions = dimensions ?? 384;
|
|
33449
32385
|
const separator = this.vector?.indexSeparator ?? "_";
|
|
33450
|
-
return
|
|
32386
|
+
return `${this.observationIndexPrefix}${separator}${usedDimensions}`;
|
|
33451
32387
|
}
|
|
33452
32388
|
async createObservationEmbeddingIndex(dimensions) {
|
|
33453
32389
|
const usedDimensions = dimensions ?? 384;
|
|
@@ -33693,7 +32629,10 @@ Notes:
|
|
|
33693
32629
|
tools[name] = tool;
|
|
33694
32630
|
}
|
|
33695
32631
|
const omConfig = normalizeObservationalMemoryConfig(mergedConfig.observationalMemory);
|
|
33696
|
-
if (omConfig?.retrieval) tools.recall = recallTool(mergedConfig, {
|
|
32632
|
+
if (omConfig?.retrieval) tools.recall = recallTool(mergedConfig, {
|
|
32633
|
+
retrievalScope: typeof omConfig.retrieval === "object" ? omConfig.retrieval.scope ?? "resource" : "resource",
|
|
32634
|
+
searchEnabled: this.hasRetrievalSearch(omConfig.retrieval)
|
|
32635
|
+
});
|
|
33697
32636
|
return tools;
|
|
33698
32637
|
}
|
|
33699
32638
|
/**
|
|
@@ -33749,7 +32688,7 @@ Notes:
|
|
|
33749
32688
|
}));
|
|
33750
32689
|
const messageIdsNeedingDeletion = /* @__PURE__ */ new Set([...messageIdsWithClearedContent, ...messageIdsWithNewEmbeddings]);
|
|
33751
32690
|
if (messageIdsNeedingDeletion.size > 0) try {
|
|
33752
|
-
const memoryIndexes = await this.getMemoryVectorIndexes();
|
|
32691
|
+
const memoryIndexes = await this.getMemoryVectorIndexes([this.messageIndexPrefix]);
|
|
33753
32692
|
const idsToDelete = [...messageIdsNeedingDeletion];
|
|
33754
32693
|
await Promise.all(memoryIndexes.map(async (indexName) => {
|
|
33755
32694
|
for (let i = 0; i < idsToDelete.length; i += VECTOR_DELETE_BATCH_SIZE) {
|
|
@@ -33808,7 +32747,7 @@ Notes:
|
|
|
33808
32747
|
const span = this.createMemorySpan("delete", observabilityContext, void 0, { messageCount: messageIds.length });
|
|
33809
32748
|
try {
|
|
33810
32749
|
await (await this.getMemoryStore()).deleteMessages(messageIds);
|
|
33811
|
-
if (this.vector) this.deleteMessageVectors(messageIds);
|
|
32750
|
+
if (this.vector) this.trackVectorCleanup(this.deleteMessageVectors(messageIds));
|
|
33812
32751
|
span?.end({
|
|
33813
32752
|
output: { success: true },
|
|
33814
32753
|
attributes: { messageCount: messageIds.length }
|
|
@@ -33824,12 +32763,14 @@ Notes:
|
|
|
33824
32763
|
/**
|
|
33825
32764
|
* Deletes vector embeddings for specific messages.
|
|
33826
32765
|
* This is called internally by deleteMessages to clean up orphaned vectors.
|
|
32766
|
+
* Only the message indexes are touched, because observation vectors can hold
|
|
32767
|
+
* text of other messages of the thread.
|
|
33827
32768
|
*
|
|
33828
32769
|
* @param messageIds - The IDs of the messages whose vectors should be deleted
|
|
33829
32770
|
*/
|
|
33830
32771
|
async deleteMessageVectors(messageIds) {
|
|
33831
32772
|
try {
|
|
33832
|
-
const memoryIndexes = await this.getMemoryVectorIndexes();
|
|
32773
|
+
const memoryIndexes = await this.getMemoryVectorIndexes([this.messageIndexPrefix]);
|
|
33833
32774
|
await Promise.all(memoryIndexes.map(async (indexName) => {
|
|
33834
32775
|
for (let i = 0; i < messageIds.length; i += VECTOR_DELETE_BATCH_SIZE) {
|
|
33835
32776
|
const batch = messageIds.slice(i, i + VECTOR_DELETE_BATCH_SIZE);
|
|
@@ -44602,4 +43543,4 @@ const agentBuilderWorkflows = {
|
|
|
44602
43543
|
//#endregion
|
|
44603
43544
|
export { agentBuilderWorkflows };
|
|
44604
43545
|
|
|
44605
|
-
//# sourceMappingURL=dist-
|
|
43546
|
+
//# sourceMappingURL=dist-CzzxT_L5.js.map
|